Save Object.observe()! (please) + make WeakMap/WeakSet observable.

Isiah Meadows isiahmeadows at
Wed Nov 4 03:46:29 UTC 2015

I was just thinking... Object.observe could, in theory, be used as a core
for a dispatcher and store in a Flux-like data flow. Basically, when a view
emits an event, you can use the first observed object as a memoized
dispatcher, and then it emits a list of changes that can then update
another observed object, the store. That store can then emit a list of
changes to be resolved with the views.

What do you all think?

On Tue, Nov 3, 2015, 22:32 Isiah Meadows <isiahmeadows at> wrote:

> There's a reason Object.observe is async: it prevents you from changing
> how the value is first assigned, so it can't work like a proxy. And
> question: how does it let you see hidden closures?
> On Tue, Nov 3, 2015, 18:28 Coroutines <coroutines at> wrote:
>> On Tue, Nov 3, 2015 at 3:22 PM, Coroutines <coroutines at> wrote:
>> > But because of what Object.observe() can do to see into closures, I'd
>> > relegate it to privileged code :>  It is incredibly useful for
>> > debugging.
>> I really need to make sure my thoughts are complete before I send a
>> message.
>> Anyway, I just wanted to say I'm viewing this through my experience with
>> Lua.
>> In Lua you would make a proxy (like I mentioned before) by creating an
>> empty table and setting the __index and __newindex metamethods to
>> trigger when a key doesn't exist for an access or having its value
>> set.  This is the only way to watch for changes, you cannot attach a
>> watch to an existing object - you create a separate object to act as
>> the proxy and replace the references to the existing/target object.
>> My last message was me realizing that Object.observe() has
>> functionality that would let you see into encapsulated, hidden
>> closures.  This is why I think Object.observe() is cool but probably
>> shouldn't be web-accessible.
>> Proxy is safe, Object.observe() should be debug-only functionality
>> ((imo)).  Like, in browsers you'd only have access to it from the
>> console not from within a page?
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list