Re: Listen to any changes to an Array

Boris Zbarsky <[email protected]> Mon, 6 Aug 2018 17:26:44 -0400
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 8/5/18 2:13 PM, James Stortz wrote:
> Is there a way to listen for any changes to an array in SpiderMonkey?

Not really, no.  When the JIT sees access on an array it will compile it 
down to direct machine code access, which can't really be interposed.

> 3.) Proxy Objects: hooks anything, but there is no MDN documentation, and
> it seems a little daunting to derive from BaseProxyHandler.

If you have the option of wrapping all the arrays you care about in 
proxies, this might be the way to go, fwiw.

-Boris