Entry: JS_SetPropertyAttributes (Function)
Summary: Sets the attributes for a specified property.
Syntax:
JSBool JS_SetPropertyAttributes(JSContext *cx, JSObject *obj,
const char *name, uintN attrs, JSBool *foundp);
Argument Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
obj JSObject * Object for which to set property attributes.
name const char * Name of the property for which to set attributes.
uintN attrsp Attribute values to set.
foundp JSBool * Flag indicating whether or not the specified property was located.
Description:
JS_SetPropertyAttributes sets the attributes for a specified property, name. cx is the context, and obj is a pointer to the object that owns the property. attrsp is an unsigned integer containing the attribute value to set, and can contain 0 or more of the following values OR'd:
ulPLI CODEJSPROP_ENUMERATE/CODE: property is visible in for loops./LI CODEJSPROP_READONLY/CODE: property is read-only.P CODEJSPROP_PERMANENT/CODE: property cannot be deleted.P CODEJSPROP_EXPORTED/CODE: property can be exported outside its object.P CODEJSPROP_INDEX/CODE: property is actually an array element.P/ul If JS_SetPropertyAttributes cannot locate an object with the specified property, it returns JS_FALSE, and foundp is undefined.
If the specified property or the specified object does not exist, foundp is set to JS_FALSE. Then, iff the property exists, but is associated with a different object, JS_SetPropertyAttributes returns JS_TRUE. Otherwise, it sets foundp to JS_TRUE, and attempts to set the attributes as specified. If the attributes can be set, JS_SetPropertyAttributes returns JS_TRUE. If not, it returns JS_FALSE.
See also:
|
|
|