I have a really hard time understanding polymer element lifecycles.
Suppose I have a custom element with a single property fooBar
. And suppose I set fooBar
as an attribute on the attribute like so.
<custom-element foo-bar="text"></custom-element>
Now let's say I'd like to use fooBar
programmatically as a property during the element lifecycle creation. So something like.
Polymer({
is: "custom-element",
properties: {
fooBar: {type: String}
},
ready: function(){
console.log(this.fooBar)
},
attached: function(){
console.log(this.fooBar)
}
})
So far as I can tell, the element property fooBar isn't loaded from the DOM attribute fooBar until after both ready
and attached
are called. This holds true even when I call async from inside the ready and attached callbacks.
Can anyone explain (1) where in the lifecycle the element properties are imported from the DOM attributes and (2) how to programattically access those attributes to do some setup work on the element?