Re: Listen to any changes to an Array

James Stortz <[email protected]> Tue, 7 Aug 2018 03:24:43 -0400
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <CAE0WHd_aKMBAbBbhOADXp6uaCb_qcSEaCU0SR+ihwSbteW8N+Q@mail.gmail.com>
Thanks, that is good news. So, proxies intercept calls/accessors and relay
it over I assume. That's a good approach, but I was initially surprised
that such functionality wasn't commonly available, or at least as robust,
until Proxies were adopted in the JS spec. It makes sense now.

I was able to get my array wrapped in a proxy easily without having to use
the C++ js:: API. It was just a matter of evaluating a script during init.
(The script creates the proxy and calls JSNative counterparts in each of
its methods. I suppose you could also set JSNative functions as its
methods.)

Curious how Proxies work, if anybody knows a good read.

-James