hey, thanks for coming back. The asynchronous unobserve in the meaning that
Object.unobserve is performed synchronously but the delivery of records is
asynchronous and performed regardless the object is not observed anymore.

Inside the observer each record can point to an object that is no more
observed and I am not sure if there is a way to understand this or if the
observer should perform the getNotifier(obj) check.

The way I would implement this is that when the Object.unobserve(obj) is
called, the queue, if any, with all previous records, is delivered at that
time, and not during the next tick.

Thoughts?


On Fri, Nov 2, 2012 at 5:17 AM, Rafael Weinstein <rafa...@chromium.org>wrote:

> 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.giammar...@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@mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> >
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to