JS_GetContextPrivate 编辑
Access a JSContext
field for application-specific data.
Syntax
void *
JS_GetContextPrivate(JSContext *cx);
void
JS_SetContextPrivate(JSContext *cx, void *data);
void *
JS_GetSecondContextPrivate(JSContext *cx); // Added in SpiderMonkey 17
void
JS_SetSecondContextPrivate(JSContext *cx, void *data); // Added in SpiderMonkey 17
Name | Type | Description |
---|---|---|
cx | JSContext * | Any context. |
data | void * | (in JS_SetContextPrivate or JS_SetSecondContextPrivate ) Pointer to application-defined data to be associated with the context cx . |
Description
Each JSContext
has two fields of type void *
which the application may use for any purpose. They are especially useful for storing data needed by callbacks. JS_GetContextPrivate
and JS_GetSecondContextPrivate
get this field and JS_SetContextPrivate
and JS_SetSecondContextPrivate
set 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
- MXR ID Search for
JS_GetSecondContextPrivate
- MXR ID Search for
JS_SetSecondContextPrivate
JS_GetRuntimePrivate
JS_SetRuntimePrivate
JS_GetCompartmentPrivate
JS_SetCompartmentPrivate
JS_GetPrivate
JS_SetPrivate
JS_GetInstancePrivate
- bug 714458
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论