Visit Mozilla.org

JS CloneFunctionObject

From MDC

Create a new Function object from an existing JSFunction.

[edit] Syntax

JSObject * JS_CloneFunctionObject(JSContext *cx,
    JSObject *funobj, JSObject *parent);
Name Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.

Requires request. (In a JS_THREADSAFE build, the caller must be in a request on this JSContext.)

funobj JSObject * Prototype for the newly cloned object.
parent JSObject * Parent to set for new object.

[edit] Description

JS_CloneFunctionObject creates a new function object from funobj. The new object shares an underlying function structure with funobj. funobj becomes the prototype for the newly cloned object, which means that its argument properties are not copied. The cloned object has parent as its parent object.

On success, JS_CloneFunctionObject returns a pointer to the newly created object. On failure, it returns NULL.

[edit] See Also

LXR ID Search for JS_CloneFunctionObject

JS_GetFunctionObject