Re: Specs and Object.observe()

On Mon, Jun 17, 2013 at 5:55 AM, François REMY <
francois.remy.dev@outlook.com> wrote:

> As far as I know, Object.observe only works for "plain objects" i.e. it
> doesn't fire when properties with getter/setter are changed. If you are
> working on a DOM spec, it's very likely you're in this specific case.
>

Object.observe works with all objects. Some objects, such as Dates, Maps,
Sets, WeakMaps and likely WeakSets will not trigger change events when
their internal data is modified via methods (setTime, set, add, delete,
etc), but defining and later modifying expando properties will trigger a
change. (This list is not exhaustive)

As François stated, accessors will not trigger change events; instead,
you'd define a set accessor that will manually call an object's notifier
function:
https://gist.github.com/rwldrn/3453045#file-complex-observe-js-L39-L56


Rick

Received on Monday, 17 June 2013 18:59:51 UTC