Object.observe inital polyfill
andrea.giammarchi at gmail.com
Fri Nov 30 14:14:47 PST 2012
wraped VS wrapped ... also setInterval there accepts arguments after the
delay so no need to use 2 functions
setInterval(theInternalFn, 100, wraped); // changed with the proper name or
... you know what? no need at all to pass the argument, isn't it, the
function is already in the same outer scope than wrapped is.
Minor things like this a part, the polling is a no-go, imho, as you might
miss changes in the middle that were absolutely fundamental for your logic,
i.e. resetting something when size = 0; or stuff like that.
Last, but not least, if this script is for node.js only or modern browsers,
the best way to implement observe() is via Proxy, changing only one thing:
you need to re address and use the observed object rather than use the
Last, but not least, I was working on some alternative solution based on
get/set thought, able to bring this stuff in ES3 capable environments too.
Maybe we can share some thoughts on it a part.
On Fri, Nov 30, 2012 at 1:06 PM, Jeremy Darling <jeremy.darling at gmail.com>wrote:
> 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
> 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
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss