-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.8.0-rc.5] observers as an array #1527
Comments
You need to use the https://www.polymer-project.org/0.8/docs/devguide/data-binding.html#path-binding In this case, you're updating the status from outside, I think instead of:
In your example, you'd do something like:
(Note: in 0.9, |
So I have to explicitly call a setter on every custom element using that object. I was under the impression that using the observers array would set up Object.observe. I was hoping I could have more than one element observe a single object, so that changes to that one object would essentially be broadcast to all the observing elements, updating their views. A use case along the lines of this example would be a chat room with a user list of ChatUser elements, and a chat window of ChatMessage elements. If "Bob" were to change his nickname to "Robert", updating his userData object would change his nickname both in the user list, and on any chat messages he's posted in the chat window. |
0.8/0.9 does not use Object.observe. This was one of the performance changes -- As I understand it, O.o and its polyfill were both quite unpredictable from a performance standpoint. If you use data binding to pass values, you can get many of the same benefits, but how exactly you'd do that may depend on how your app is set up. I recommend putting together a code sample and either posting a question on Stack Overflow or joining the Polymer slack channel (bit.ly/polymerslack)... There are a lot of people on there who've been working with 0.8/0.9 and may have suggestions. |
Thank you very much for your help. I'll do as you've suggested. |
Property observers work when custom element is instantiated, but never after that. No errors in console. Here is the javascript from the custom element definition used in my test:
Testing the custom element's observer:
The text was updated successfully, but these errors were encountered: