Entry: JS_DefineFunctions (Function)
Summary: Creates one or more functions for a JS object.
Syntax:
JSBool JS_DefineFunctions(JSContext *cx, JSObject *obj,
JSFunctionSpec *fs);
Argument Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
obj JSObject * Object for which to define functions.
fs JSFunctionSpec * A null-terminated array of function specifications. Each element of the array defines an individual function, its name, the built-in native C call it wraps, the number of arguments it takes, and its attribute flag.
Description:
JS_DefineFunctions creates one or more functions and makes them properties (methods) of a specified object, obj.
fs is a pointer to the first element of an array of JSFunctionSpec. Each array element defines a single function: its name, the native C call wrapped by the function, the number of arguments passed to the function, and its attribute flags. The last element of the array must contain zero values. JS_DefineFunctions creates one function for each non-zero element in the array.
JS_DefineFunctions always returns JS_TRUE, indicating it has created all functions specified in the array.
See also:
|
|
|