Nevermind, looked through the source and yep, Array's have to be on the
path. So to get around that I made a lightweight ObservedArray class, you
can grab it here if it's useful to anyone else who, like me, made pretty
heavy use of Array.observe. https://github.com/hobberwickey/observables
basic usage:
var arr = new ObservedArray(),
observer = arr.observe( function(splices){ console.log('cool right?',
splices) } );
arr.push("observed!"); //will output "'cool right', [{index: 0, removed:
[], addedCount: 1}]"
observer.close(); //removes the observer
You can also batch calls so you don't have to call the observers after
every push, pop, etc...
var arr = new ObservedArray(),
batch = arr.batch();
batch.push("no observers run");
batch.push("until you flush");
batch.flush();
On Wednesday, June 3, 2015 at 10:27:45 AM UTC-4, Joel Weber wrote:
>
> I see in the migration notes that Array observation has been replaced by
> methods (push, pop, etc...) does that mean that an Array needs to be
> accessible via 'this' to be observed now or is there still something under
> the hood you can hook into?
>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/6f224219-8999-4b55-b632-9d03d8d9f104%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.