Skip to content
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] observers as an object. #1452

Closed
blasten opened this issue Apr 25, 2015 · 3 comments
Closed

[0.8] observers as an object. #1452

blasten opened this issue Apr 25, 2015 · 3 comments

Comments

@blasten
Copy link
Contributor

blasten commented Apr 25, 2015

I was trying to use the observer object to observe for changes to properties and apparently it only expects arrays.
Reference: https://www.polymer-project.org/0.8/docs/devguide/properties.html#observing-path-changes

_addComplexObserverEffects: function(observers) {
      if (observers) {
        // Error: Uncaught TypeError: observers.forEach is not a function
        observers.forEach(function(observer) {
          this._addComplexObserverEffect(observer);
        }, this);
      }
}

Stack trace:

Polymer.Base._addFeature._addComplexObserverEffects (effects.html:120)
Polymer.Base._addFeature._prepBehavior (polymer.html:50)
Polymer.Base._addFeature._prepBehaviors (behaviors.html:47)
Polymer.Base._addFeature._registerFeatures (polymer.html:41)
Polymer.Base.registerCallback (base.html:22)
desugar (polymer-bootstrap.html:37)
window.Polymer (polymer-bootstrap.html:21)
(anonymous function) (iron-range.html:92)
@kevinpschaaf
Copy link
Member

In v0.8.0-rc.5, an API change was made such that complex observers (for multiple dependencies or paths) are specified in an array of strings that specify a method signature, using the same format as computed properties.

https://github.com/Polymer/polymer/blob/0.8-preview/PRIMER.md#multiple-property-observation

Unfortunately, the website documentation for 0.8 is lagging the code by a week or two, although we try to keep the primer I linked to in lock-step with the code since it's in the same repo.

@aoisensi
Copy link

👍

@blasten
Copy link
Contributor Author

blasten commented Apr 28, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants