Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polymer ready vs connectedCallback

Tags:

polymer-2.x

I'm wondering what is is the importance of ready() method in polymer and what is the meaning of on-time initialization for such method and what is the differences between read() and connectedCallback() ???


1 Answers

The following should help.

connectedCallback can be called more than once

...

Generally all setup work in connectedCallback should be balanced with associated teardown work in disconnectedCallback; if not it usually means connectedCallback is the wrong place to do it

...

At this point it's hard to contrive general a use case where ready is the only/best place to do work, although they do come up from time to time in very specific cases.

...

ready is called only once, so work done here based on a property value may become invalidated if the property value is changed at a later point by the user

See https://github.com/Polymer/polymer/issues/4108#issuecomment-258983943

like image 150
Frank R. Avatar answered Sep 27 '26 17:09

Frank R.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!