Description
JS_DefineElement defines a single element or numeric property for a specified object, obj .index is the slot number in the array for which to define an element. It may be an valid jsval integer. value is a jsval that defines the element's data type and initial value. getter and setter identify the getProperty and setProperty methods for the element, respectively. If you pass null values for these entries, JS_DefineElement assigns the default getProperty and setProperty methods to this element. flags contains the property flags to set for the newly created element. The following table lists possible values you can pass in flags , either singly, or OR 'd together:
Flag
|
Purpose
|
JSPROP_ENUMERATE |
Element is visible in for and in loops.
|
JSPROP_READONLY |
Element is read only.
|
JSPROP_PERMANENT |
Element cannot be deleted.
|
JSPROP_EXPORTED |
Element 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 * .
|
If it successfully creates the element, JS_DefineElement returns JS_TRUE . Otherwise it returns JS_FALSE .
|