Synchronous Object.observe but Asynchronous Object.unobserve ?

Rafael Weinstein rafaelw at chromium.org
Fri Nov 2 05:17:25 PDT 2012


Andrea,

I believe the example is correct. The way the API works is this:

Object.observe and Object.unobserve both *synchronously*
register/unregister your callback as observing/unobserving any given
object. The asynchrony has to do with having changeRecords delivered
-- that happens asynchronously.

I don't understand the leak you are describing. Perhaps you can give a
concrete example and how it goes wrong.

On Thu, Nov 1, 2012 at 9:32 PM, Andrea Giammarchi
<andrea.giammarchi at gmail.com> wrote:
> Just wondering if this is actually meant/expected, I am talking about the
> example here:
>
> http://wiki.ecmascript.org/doku.php?id=harmony:observe#example
>
> and the fact it should show something in console while in my opinion that
> should show nothing since the Object.unobserve is called in the same "tick"
>
> Then I read the algo and I wonder if this won't create many problems, i.e.
> enabling a new way to leak objects through observers that should not be
> called once the object is not observed anymore, specially because there's no
> way to understand if the object is observed or not, isn't it?
>
> Thanks for any sort of clarification.
>
> br
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list