JS DefineConstDoubles

Create multiple constant double-valued properties on an object.

Syntax

JSBool JS_DefineConstDoubles(JSContext *cx, JSObject *obj,
    JSConstDoubleSpec *cds);
Name Type Description
cx JSContext * The context in which to define the new properties. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
obj JSObject * Object for which to create new properties.
cds JSConstDoubleSpec * Pointer to an array of JSConstDoubleSpec records 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. Each property is automatically assigned attributes as specified in the flags field of the JSConstDoubleSpec structure pointed to by cds. If flags is set to 0, the attributes for the property are automatically set to JSPROP_PERMANENT | JSPROP_READONLY.

cds is a pointer to the first element of an array of JSConstDoubleSpec 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 creates one property for each element in the array what contains a non-zero name field.

On success, JS_DefineConstDoubles returns JS_TRUE, indicating it has created all properties listed in the array. Otherwise it returns JS_FALSE.

See Also

MXR ID Search for JS_DefineConstDoubles

JS_DefineElement, JS_DefineProperties, JS_DefineProperty, JS_DefinePropertyWithTinyId

Document Tags and Contributors

Last updated by: Jorend,