dan
dan

Reputation: 2957

is polymer/observe-js part of polymer.js or an add-in for additional functionality

Assuming you are using Chrome latest with native support for Web Components then all we need for the additional sugar is polymer.js or import polymer.html.

1) Is the observe-js part of polymer.js

2) Does observe-js add additional functionality that is not included in polymer.js beyond just the pollyfill part.

From the observe-js docs it says it adds PathObserver, ArrayObserver, ObjectObserver, CompoundObserver, ObserverTransform functionality. The Polymer API docs have the observe properties,changed watchers, and observe-blocks.

3)What's the difference between the two or when the Polymer API docs talk about observe they are really using the observe-js?

One of the main problems I have run across with object.observe is nested object support which is lacking natively.

4)Does polymer.js handle the issue of object.observe and nested objects?

Thanks, Dan

Upvotes: 1

Views: 202

Answers (1)

Scott Miles
Scott Miles

Reputation: 11027

1) Is the observe-js part of polymer.js

Yes. You can use it separately, but if you load polymer.js, observe-js is included.

2) Does observe-js add additional functionality that is not included in polymer.js beyond just the pollyfill part.

All those *Observer things you listed come from observe-js.

The Polymer API docs have the observe properties,changed watchers, and observe-blocks.

That's all Polymer specific, on top of observe-js.

3)What's the difference between the two or when the Polymer API docs talk about observe they are really using the observe-js?

Polymer has extra features that are implemented using observe-js, but they are not the same thing exactly.

One of the main problems I have run across with object.observe is nested object support which is lacking natively.

IMO, it's not quite that simple. There can be no general solution for 'observe arbitrary object graph`, because an arbitrary graph could be so deeply nested that it becomes impossible to observe efficiently. This means it's up to the application programmer to specify nested objects objects of interest.

In particular, in Polymer, when you bind to nested objects you express an interest in them, and they are observed.

4)Does polymer.js handle the issue of object.observe and nested objects

As above.

Upvotes: 1

Related Questions