Object.observe inital polyfill

Jeremy Darling jeremy.darling at gmail.com
Fri Nov 30 13:06:41 PST 2012


We are looking at using Object.observe in a current project as it will ease
our development time greatly.  To that avail I've created a simple (call it
proof of concept) polyfill/shim (whats the difference?) (
https://github.com/jdarling/Object.observe) that compares quite well with
the Chromium build that includes Object.observe.

I know Object.observe is only a proposal but the idea was so close to our
existing binding solution that it is worth expanding upon.

I noticed a few things though after posting it up:
  According to the email at
https://mail.mozilla.org/pipermail/es-discuss/2012-August/024759.htmlObject.observe
does not pay attention to calculated properties.  To me this
mean properties surfaced through defineProperty() that have a getter, is
this true (I was planning on adding better support for this if I'm wrong).

  Notifier.NotifierPrototype isn't well defined, so I left it out
currently.  Can you provide a high level of what exactly it should look
like?

  For getNotifier() I'm using a self sealing/modifying solution.  Does this
seem appropriate or is there a better way?

  Finally, setTimeout, etc pass back an indexer that can be used for
clearing rather than having to maintain the actual method.  This helps when
using anonymous functions as the callback.  Is there a reason that
Object.observe returns a full object that can't be used to clear the
observation, or did I miss something?

I know I'm using polling, but I want to know just how close I have got.
 According to the test scripts I've found and my own tests I'm fairly
close.  If it is then I plan on using getters/setters and property
overrides to get better response times.  I just want community feedback
first to make sure.

 - Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121130/aabd5fb9/attachment.html>


More information about the es-discuss mailing list