Object.observe() is a proposed mechanism for bringing true data-binding to the browser. It exposes a mechanism for observing changes to objects and arrays, notifying others of mutations made to these objects. In my JSConf talk on O.o() I walk developers through the API, discussing how it will change things for AngularJS, Ember and Polymer. Some of these libraries have already explored replacing their dirty-checking and set-traps with
Object.observe(). In fact, the Angular team reported last year that their bindings saw a 20-40x increase in speed when using an early version of it.
This is promising and the hope is once browser vendors other than Chrome implement the feature, many libraries using data-binding will see considerable performance boosts.
I plan on doing a more detailed write-up on
Object.observe() in the near future, but until then you might be interested in the following resources:
- ObserveJS - an Object.observe() Polyfill
- TemplateBinding - a TemplateBinding Polyfill
- Gist with some examples from my talk
- Rafael Weinstein's September slides on Object.observe()
- Object.observe() V8 tracking bug
- Respond to change with Object.observe()
- Object.observe() on the Harmony wiki
- Simplest example of using Object.observe()
- An intro to Object.observe() on the Bocoup blog