We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

JS GetContextPrivate

Access a JSContext field for application-specific data.


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.


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

Last updated by: Jorend,