Subj : Re: using js_HashString in a getter callback To : netscape.public.mozilla.jseng From : Brann Joly Date : Wed May 26 2004 11:52 am I understand, but why should i use the reserved slots rather than the private slot? (I only need one pointer) "Sterling Bates" a écrit dans le message de news:c8vs6o$s8e2@ripley.netscape.com... > Brann Joly wrote: > > >>Don't you mean JS_SetReservedSlot, not JS_SetPrivate, here? > > > > I meant JS_SetPrivate, but of course I may be wrong. What I want is to > > attach some data to a function object, so I can get it back when my callback > > is called by SM. Since I use JS_SetPrivate to attach private data to > > objects, i thought it was a good idea to use it for functions too. What's > > the difference between the 2 functions? I can't find JS_SetReservedSlot in > > the apidoc > > In JSClass.reserveSlots you can set up to 255 reserved slots. While > there are other reserved slots for the engine internals, you can > reference the slots from 0..n-1. > > Here's the signature for JS_SetReservedSlot: > > JSBool JS_SetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, > jsval v); > > And the signature for JS_GetReservedSlot: > > JSBool JS_GetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, > jsval *vp); > > Sterling .