Create an object that is a property of another object.
JSObject * JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *clasp, JSObject *proto, uintN flags);
| || ||The context in which to create the new object. Requires request. In a |
| || ||Object to which this new object belongs as a property.|
| || ||Name of the property being defined in |
| || ||Class to use for the new object.|
| || ||Prototype object to use for the new object, or |
| || ||Property attributes for the new property being defined.|
JS_DefineObject creates a new object of the class
clasp and assigns it to a new property of an existing object,
name is the property name to assign to
obj to hold the new object, and
flags contains the property attributes to set for the newly created property.
proto becomes the new object's prototype. If
The new object's parent is
JS_DefineObject does not call
clasp->constructor. Initialization of the new object is up to the caller.
JS_DefineObject returns a pointer to the new object. On error or exception (if the object cannot be created, the property already exists, or the property cannot be created),
This function combines two operations: creating an object and storing it in a property of another object. Use
JS_NewObject to create a new object without storing it in a property of another object. Use
JS_DefineElement to create a property without creating a new object.