Updates to Object.observe

Tom Van Cutsem tomvc.be at gmail.com
Wed Jul 18 00:38:34 PDT 2012


2012/7/18 Erik Arvidsson <erik.arvidsson at gmail.com>

> We've done a bunch of updates to Object.observe in preparation for the
> next weeks face to face meeting. The updates are based on feedback
> from multiple people but more feedback is always welcome.
>
> http://wiki.ecmascript.org/doku.php?id=strawman:observe


To better understand strawman:observe, I implemented it in Javascript using
(direct) proxies. I immediately want to point out that the purpose here is
_not_ to show that observable objects can be implemented using proxies (we
all know that), and I'm not advocating that proxies subsume this strawman
in any way.

Think of this prototype implementation as an executable straw spec, so we
can play around with the API and see what the effects are. Of course, in my
implementation, one can only call Object.observe on special "observable"
objects that have the necessary internals to support notification. That is
precisely the limitation that this strawman aims to overcome, but for
testing purposes it doesn't matter.

The code lives at:
<
https://github.com/tvcutsem/harmony-reflect/blob/master/examples/observer.js
>

A unit test for the example from the strawman page is here:
<
https://github.com/tvcutsem/harmony-reflect/blob/master/examples/observer.html
>

That html file is also served from <
http://soft.vub.ac.be/~tvcutsem/proxies/observer.html>
(the example needs proxies & weakmaps, so open in Firefox 13 or Chrome 20
with experimental JS flag in chrome://flags turned on)
(open a console to see the logged output)

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120718/6cb17a5c/attachment.html>


More information about the es-discuss mailing list