C-Level Extensibility > The C-level extensibility API > typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) |
typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval)
Description
The function signature for C-level implementations of JavaScript functions, where:
cx is a pointer to an opaque JSContext structure, which must be passed to some of the functions in the JavaScript API. This variable holds the interpreter's execution context. |
|
obj is a pointer to the object in whose context the script executes. While the script is running, the this keyword is equal to this object. |
|
argc is the number of arguments being passed to the function. |
|
argv is a pointer to an array of jsvals. The array is argc elements in length. |
|
rval is a pointer to a single jsval. The function's return value should be written to *rval. |
The function returns JS_TRUE upon success or JS_FALSE upon failure. If JS_FALSE is returned, the current script stops executing.