Re: Array property of custom object
Mihai Dobrescu <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On Monday, May 2, 2016 at 10:06:56 PM UTC+3, Boris Zbarsky wrote: > On 5/2/16 2:10 PM, Mihai Dobrescu wrote: > > For "info", I need some Array wrapper for objects of type jsChar (it is not a string). jsChar will have some private data of type char. > > Sounds like you want to implement a proxy (in the js::Proxy sense) that > will do whatever it is you want. It won't be an Array from the point of > view of JS consumers, but then again you don't want actual Array > behavior either (e.g. you don't want people doing push() on your thing), > right? > > -Boris I need to e able to replace array elements, probably I will need to add/remove elements too. Aren't all the JS objects containing private data proxies (the one with the JSCLASS_HAS_PRIVATE flag)?