This article covers features introduced in SpiderMonkey 1.8.5

Please provide a description for this function.


JS_SetCompartmentPrivate(JSCompartment *compartment, void *data);

void *
JS_GetCompartmentPrivate(JSCompartment *compartment);
Name Type Description
compartment JSCompartment * Any compartment
data void * (in JS_SetCompartmentPrivate) Pointer to application-defined data to be associated with the compartment.


Each JSCompartment 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_GetCompartmentPrivate gets this field and JS_SetCompartmentPrivate 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

Document Tags and Contributors

 Contributors to this page: arai, fscholz, ethertank, trevorh, markg
 Last updated by: arai,