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_NewObject (Function)
Summary:     Instantiates a new object.
Syntax:
JSObject * JS_NewObject(JSContext *cx, JSClass *clasp,
JSObject *proto, JSObject *parent);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     clasp     JSClass *     Pointer to the class to use for the new object.
                 
     proto     JSObject *     Pointer to the prototype object to use for the new class.
                 
     parent     JSObject *     Pointer to which to set the new object's __parent__ property.
                 
Description:
JS_NewObject instantiates a new object based on a specified class, prototype, and parent object. cx is a pointer to a context associated with the runtime in which to establish the new object. clasp is a pointer to an existing class to use for internal methods, such as finalizeproto is an optional pointer to the prototype object with which to associate the new object.

Set proto to NULL to force JS to assign a prototype object for you. In this case, JS_NewObject attempts to assign the new object the prototype object belonging to clasp, if one is defined there. Otherwise, it creates an empty object stub for the prototype.

parent is an optional pointer to an existing object to which to set the new object's parent object property. You can set parent to NULL if you do not want to set the parent property.

On success, JS_NewObject returns a pointer to the newly instantiated object. Otherwise it returns NULL.


See also:
JS_ConstructObject
JS_DefineObject
JS_GetFunctionObject
JS_NewArrayObject
JS_ValueToObject

[sh-index] Back to list of manuals