Description
JS_DefineObject instantiates and names a new object for an existing object, obj . name is the property name to assign to obj to hold the new object, and flags contains the property flags to set for the newly created property. The following table lists possible values you can pass in flags , either singly, or OR 'd together:
Flag
|
Purpose
|
JSPROP_ENUMERATE |
Property is visible to for and in loops.
|
JSPROP_READONLY |
Property is read only.
|
JSPROP_PERMANENT |
Property cannot be deleted.
|
JSPROP_EXPORTED |
Property can be imported by other objects.
|
JSPROP_INDEX |
Property is actually an index into an array of properties, and is cast to a const char * .
|
clasp is a pointer to the base class to use when creating the new object, and proto is an pointer to the prototype upon which to base the new object. If you set proto to NULL , JS sets the prototype object for you. The parent object for the new object is set to obj .
JS_DefineObject returns a pointer to the newly created property object if successful. If the property already exists, or cannot be created, JS_DefineObject returns NULL .
|