I am writing a Polymer 2 element that decorated <iron-form>
My element needs to work with <iron-form>and the form itself that is decorated by <iron-form> -- which is stored as _form in the <iron-form> element.
At the moment I have this:
ready () {
super.ready()
var self = this
this.ironForm = this.allChildrenNamed('IRON-FORM', true)
if (!this.ironForm) throw new Error('hot-form must contain an iron-form element which will be decorated')
setTimeout(function () {
self.form = self.ironForm._form
}, 0)
}
Is this a reliable way to go about this?
WIth that setTimeout, <iron-form> has enough time to assign _form. Will this be the case longer-term?
@TimvdLippe commeted here: https://github.com/Polymer/polymer/issues/5149
Since this is mostly an iron-form specific question, I would advise to open an issue there and potentially request a new event to be notified when _form is set, in the attached callback.
Would you accept a PR with the addition of the newly emitted event?
Or, what would you advise?
I am writing a Polymer 2 element that decorated
<iron-form>
My element needs to work with<iron-form>
and the form itself that is decorated by<iron-form>
-- which is stored as_form
in the<iron-form>
element.At the moment I have this:
Is this a reliable way to go about this? WIth that setTimeout,
<iron-form>
has enough time to assign _form. Will this be the case longer-term? @TimvdLippe commeted here: https://github.com/Polymer/polymer/issues/5149Would you accept a PR with the addition of the newly emitted event? Or, what would you advise?