Mozilla.com

  1. MDC
  2. Main Page
  3. SpiderMonkey
  4. JSAPI Reference
  5. JSObjectOps.defineProperty
Table of contents
  1. 1. Syntax
  2. 2. Description
Table of contents
  1. 1. Syntax
  2. 2. Description

Warning sign
Warning: JSObjectOps is not a supported API. Details of the API may change from one release to the next. This documentation should be considered SpiderMonkey internals documentation, not API documentation. See bug 408416 .

The JSObjectOps.defineProperty callback is called whenever an object property is defined. It implements JS_DefineProperty.

Syntax

JSBool (*JSDefinePropOp)(JSContext *cx, JSObject *obj,
    jsid id, jsval value,
    JSPropertyOp getter, JSPropertyOp setter,
    uintN attrs, JSProperty **propp);
Name Type Description
cx JSContext * Pointer to the JS context in which the property is being defined.
obj JSObject * The object on which the property is being defined.
id jsid The name or index of the property to define.
value jsval The initial value for the new property.
getter JSPropertyOp The getter for the new property.
setter JSPropertyOp The setter for the new property.
attrs uintN The property attributes for the new property.
propp JSProperty ** Out parameter. May be null. On success, the callback stores a pointer to the new property in *propp if propp is non-null.

Description

Define obj[id], a direct property of obj named id, having the given initial value, with the specified getter, setter, and attributes. If the propp out param is non-null, *propp on successful return contains an opaque property pointer usable as a speedup hint with JSAttributesOp. But note that propp may be null, indicating that the caller is not interested in recovering an opaque pointer to the newly-defined property.

If propp is non-null and JSObjectOps.defineProperty succeeds, its caller must be sure to drop *propp using JSObjectOps.dropProperty in short order, just as with JSObjectOps.lookupProperty.

Page last modified 18:46, 14 Apr 2008 by Jorend

Files (0)