AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry:     JS_SetPrivate (Function)
Summary:     Sets the private data for a JS object.
Syntax:
JSBool JS_SetPrivate(JSContext *cx, JSObject *obj, void *data);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     obj     JSObject *     Object for which to set private data.
                 
     data     void *     Private data for the object.
                 
Description:
JS_SetPrivate sets the private data pointer for a specified object, obj. To set private data for an object, the object must be an instance of a class, and the class must include JSCLASS_HAS_PRIVATE in its flag set.

Only a pointer to data is stored with the object. The data pointer is converted to a jsval for storage purposes. You must free this pointer in your finalization code if you allocated storage for it. It is up to your application to maintain the actual data.

If successful, JS_SetPrivate returns JS_TRUE. Otherwise it returns JS_FALSE.


See also:
JSCLASS_HAS_PRIVATE
JSClass
JS_GetInstancePrivate
JS_GetPrivate
JS_InitClass
PRIVATE_TO_JSVAL

[sh-index] Back to list of manuals