0.8 documentation incorrect for sub-property observers?

46 views
Skip to first unread message

hadf...@gmail.com

unread,
May 14, 2015, 9:18:40 AM5/14/15
to polym...@googlegroups.com
Very happy to see the rapid progress being made toward 1.0. You guys are awesome. 

In the Observing changes to sub-properties section of the 0.8 dev guide, the following example is given of how to define an observer of a sub-property:

  observers: {
    'user.manager.*': 'userManagerChanged'
  }

However, with v0.9.1, when I define an observer this way I get the error "TypeError: observers.forEach is not a function" in Polymer.Base._addFeature._addComplexObserverEffects (effects.html:120). From what I can tell, the following seems to be the correct syntax:

  observers: [
    'userManagerChanged(user.manager.*)'
  ],

Is this the correct syntax, or is there a bug in the current implementation?

Thanks very much!

Arthur Evans

unread,
May 14, 2015, 10:48:19 AM5/14/15
to hadf...@gmail.com, polymer-dev
Hi,

Yes, the format changed between 0.8-rc.2 and 0.9. Observers now look more like computed properties:

  observers: [
    'userManagerChanged(user.manager.*)'
  ]

Note that `observers` is now an array, not an object.

Updated doc is imminent, as soon as we have an official 0.9 release.

Thanks,
Arthur


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/27a5d297-a0aa-43b7-a5f0-d6af0c5dd2c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Giuffrida

unread,
May 14, 2015, 12:41:57 PM5/14/15
to Arthur Evans, hadf...@gmail.com, polymer-dev

It sucks that the docs will remain outdated, but if you're targeting a specific version like v0.8.0-rc7 you can get mostly up to date information from that revision's PRIMER. md, e.g.: https://github.com/Polymer/polymer/blob/v0.8.0-rc.7/PRIMER.md

Which in this case has the correct syntax for observers.

Michael

Reply all
Reply to author
Forward
0 new messages