JavaScript-1.5 Reference

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);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
objJSObject *Object for which to set property attributes.
nameconst char *Name of the property for which to set attributes.
uintNattrspAttribute values to set.
foundpJSBool *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:

  • JSPROP_ENUMERATE: property is visible in for loops.
  • JSPROP_READONLY: property is read-only.

    JSPROP_PERMANENT: property cannot be deleted.

    JSPROP_EXPORTED: property can be exported outside its object.

    JSPROP_INDEX: property is actually an array element.

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

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_GetPropertyAttributes ]

This page was generated by APIDOC