Subj : Re: [spidermonkey] getter/setter for all properties of an object To : franck From : Brendan Eich Date : Fri Aug 05 2005 11:45 am franck wrote: > Hello, > > I am tring to make a little object that allows me to listen all > properties get and set of an object ( a kind of super watch ). > All is working properly, however I noticed that even if I defined my own > setProperty, the property is stored in the object ( I can see it using a > for-in loop ). If you don't want a property to be enumerated by a for-in loop, you must define it without the JSPROP_ENUMERATE attribute. In your example, you set obj.foo = 1234, which makes an enumerable property, per ECMA-262. You would have to add a resolve hook that defines the property id being resolved with 0 attributes to avoid this. If you want to avoid storing the last-got or last-set value in a slot (the normal storage for a property value, allocated by default), you would want to use JSPROP_SHARED as the attributes when resolving. If you wish to resolve only when the id is being assigned to, you want JSCLASS_NEW_RESOLVE, and in your JSNewResolveOp, define that id only if JSRESOLVE_ASSIGNING. /be .