JavaScript-1.5 Reference

JS_SetParent Function

Summary

Sets the parent for an object.

Syntax

JSBool JS_SetParent(JSContext *cx, JSObject *obj,
    JSObject *parent);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
objJSObject *Pointer to the object for which to set the parent.
parentJSObject *Pointer to the parent object to use.

Description

JS_SetParent enables you to set the parent object for a specified object. A parent object is part of the enclosing scope chain for an object. Ordinarily you set a parent for an object when you create the object with JS_NewObject, but if you do not set a parent at that time, you can later call JS_SetParent to do so.

obj is a pointer to an existing JS object, and parent is a pointer to a second existing object of which the first object is a child. If JS_SetParent is successful, it returns JS_TRUE. Otherwise, if it cannot create and fill a parent slot for the object, it returns JS_FALSE.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_GetConstructor | JS_GetParent | JS_NewObject ]

This page was generated by APIDOC