JS SetContextCallback
From MDC
Specifies a callback function that is automatically called whenever a JSContext is created or destroyed.
[edit] Syntax
JSContextCallback JS_SetContextCallback(JSRuntime *rt, JSContextCallback cb)
| Name | Type | Description |
|---|---|---|
rt |
JSRuntime * |
Pointer to a JS runtime. |
cb |
JSContextCallback |
Pointer to the callback function, described below. |
[edit] Callback syntax
typedef JSBool (*JSContextCallback)(JSContext *cx, uintN contextOp);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
Pointer to a JSContext which the callback may use to call into JSAPI functions. This is the context which was just created, or is about to be destroyed. For example, the callback my call JS_GetContextPrivate(cx) in order to free up resources previously allocated by JS_SetContextPrivate. |
unitN |
contextOp |
The possible values for contextOp when the runtime calls the callback are:
|
[edit] Description
JS_SetContextCallback specifies a callback function that is automatically called when JSContexts are created or destroyed. Only one callback function may be specified per JS runtime. This function returns the previous context callback, if any, else NULL.