Create multiple constant double or integer valued properties on an object.
Syntax
bool
JS_DefineConstDoubles(JSContext *cx, JS::HandleObject obj,
                      const JSConstDoubleSpec *cds);
bool
JS_DefineConstIntegers(JSContext *cx, JS::HandleObject obj,
                       const JSConstIntegerSpec *cis); // Added in SpiderMonkey 38
| Name | Type | Description | 
|---|---|---|
| cx | JSContext * | The context in which to define the new properties. Requires request. In a JS_THREADSAFEbuild, the caller must be in a request on thisJSContext. | 
| obj | JSObject * | Object for which to create new properties. | 
| cds | JSConstDoubleSpec * | Pointer to an array of JSConstDoubleSpecrecords containing property names and values to create. The last array element must contain zero-valued members. | 
| cis | JSConstIntegerSpec * | Pointer to an array of JSConstIntegerSpecrecords containing property names and values to create. The last array element must contain zero-valued members. | 
Description
JS_DefineConstDoubles creates one or more properties for a specified object, obj, where each property consists of a double value.
JS_DefineConstIntegers creates one or more properties for a specified object, obj, where each property consists of a int32_t value.
The attributes for each property is set to JSPROP_READONLY | JSPROP_PERMANENT.
Obsolete from JSAPI 35
Each property is automatically assigned attributes as specified in the flags field of the JSConstDoubleSpec/JSConstIntegerSpec structure pointed to by cds/cis. If flags is set to 0, the attributes for the property are automatically set to JSPROP_PERMANENT | JSPROP_READONLY.
cds and cis are pointers to the first element of an array of JSConstDoubleSpec/JSConstIntegerSpec structures. Each array element defines a single property name and property value to create. The name field of the last element of the array must contain 0.
JS_DefineConstDoubles/JS_DefineConstIntegers create one property for each element in the array what contains a non-zero name field.
On success, JS_DefineConstDoubles/JS_DefineConstIntegers returns true, indicating it has created all properties listed in the array. Otherwise it returns false.