JS_GetContextPrivate

Access a JSContext field for application-specific data.

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.

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.

See Also

MXR ID Search for JS_GetContextPrivate
MXR ID Search for JS_SetContextPrivate

JS_GetRuntimePrivate, JS_SetRuntimePrivate, JS_GetPrivate, JS_SetPrivate, JS_GetInstancePrivate

Document Tags and Contributors

Contributors to this page: Tservo, Dria, Cheatah, Nickolay, Jorend
Last updated by: Jorend,