Visit Mozilla.org

JS GetContextPrivate

From MDC

Access a JSContext field for application-specific data.

[edit] Syntax

void * JS_GetContextPrivate(JSContext *cx);

void JS_SetContextPrivate(JSContext *cx, void *data);
Name Type Description
cx JSContext * Any context.
data void * (in JS_SetContextPrivate) Pointer to application-defined data to be associated with the context cx.

[edit] Description

Each JSContext has a field of type void * which the application may use for any purpose. It is especially useful for storing data needed by callbacks. JS_GetContextPrivate gets this field and JS_SetContextPrivate sets it. The field is initially NULL.

Memory management for this private data is the application's responsibility. The JavaScript engine itself never uses it.

[edit] See Also

LXR ID Search for JS_GetContextPrivate
LXR ID Search for JS_SetContextPrivate

JS_GetRuntimePrivate, JS_SetRuntimePrivate, JS_GetPrivate, JS_SetPrivate, JS_GetInstancePrivate