Experimental implementation of Object.observe & JS Utility library now available

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Aug 19 10:11:21 PDT 2012


but then, as you write, if I decide to expose an object or I can reach an
object and then use Object.observe there is no ownership problem since
whoever let me reach that object didn't want to block me doing so ... also
because the Object.freeze(exposedObject) is an easy solution where
internally, that frozen object, could be attached through a Map or WeakMap
to another one not exposed so ... again, this ownership "thingy" for
objects anyone could reach does not look like a good reason at all to avoid
implementation of Object.observe

The global context and all its namespaces are another example, as well as
the whole DOM is since me, the one that would like to create an element and
use similar Object.freeze(myOwnElement) operation, cannot prevent other
people to add listeners or change styles ... right ?

So as it is, and I am the one saying "that's correct", for listeners, where
if you don't own the listener you cannot remove it, I can't see why
Object.observe would have so many problems with the ownership ... anyone
can observe unless the object is marked as frozen but none can know who
else islistening ... and this is actually, in my opinion, good!

Maybe, a good compromise would be to be able to prevent "propagation" of
other listeners so that the first one that set a listener, let's call it
the owner, can prevent other listeners from being called or flag that
listener as "the only one allowed for that object" ?

This could make Object.observe more reasonable without needing to freeze
anything still being free to expose objects ... just saying, to me that
would work in any case ( a secured observation ).

Thoughts, welcome
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120819/a8ab01b6/attachment.html>


More information about the es-discuss mailing list