docs
Loading...
Searching...
No Matches
JSObjectRefPrivate.h

Functions

bool JSObjectSetPrivateProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value)
 Sets a private property on an object. This private property cannot be accessed from within JavaScript.
JSValueRef JSObjectGetPrivateProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
 Gets a private property from an object.
bool JSObjectDeletePrivateProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
 Deletes a private property from an object.
JSObjectRef JSObjectGetProxyTarget (JSObjectRef)
JSGlobalContextRef JSObjectGetGlobalContext (JSObjectRef object)

Function Documentation

◆ JSObjectDeletePrivateProperty()

bool JSObjectDeletePrivateProperty ( JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName )

Deletes a private property from an object.

Parameters
ctxThe execution context to use.
objectThe JSObject whose private property you want to delete.
propertyNameA JSString containing the property's name.
Returns
true if object can store private data, otherwise false.
Note
The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data.

◆ JSObjectGetGlobalContext()

JSGlobalContextRef JSObjectGetGlobalContext ( JSObjectRef object)

◆ JSObjectGetPrivateProperty()

JSValueRef JSObjectGetPrivateProperty ( JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName )

Gets a private property from an object.

Parameters
ctxThe execution context to use.
objectThe JSObject whose private property you want to get.
propertyNameA JSString containing the property's name.
Returns
The property's value if object has the property, otherwise NULL.

◆ JSObjectGetProxyTarget()

JSObjectRef JSObjectGetProxyTarget ( JSObjectRef )

◆ JSObjectSetPrivateProperty()

bool JSObjectSetPrivateProperty ( JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName,
JSValueRef value )

Sets a private property on an object. This private property cannot be accessed from within JavaScript.

Parameters
ctxThe execution context to use.
objectThe JSObject whose private property you want to set.
propertyNameA JSString containing the property's name.
valueA JSValue to use as the property's value. This may be NULL.
Returns
true if object can store private data, otherwise false.
Note

This API allows you to store JS values directly an object in a way that will be ensure that they are kept alive without exposing them to JavaScript code and without introducing the reference cycles that may occur when using JSValueProtect.

The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private properties.

Go to the source code of this file.