JSObjectMake(_:_:_:)
Creates a JavaScript object.
Declaration
func JSObjectMake(_ ctx: JSContextRef!, _ jsClass: JSClassRef!, _ data: UnsafeMutableRawPointer!) -> JSObjectRef!Parameters
- ctx:
The execution context to use.
- jsClass:
The Jsclassref to assign to the object. Pass
NULLto use the default object class. - data:
A pointer to set as the object’s private data. Pass
NULLto specify no private data.
Return Value
A JSObjectRef with the specified class and private data.
Discussion
The default object class doesn’t allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake(_:_:_:) if you want your object to be able to store private data.
The system sets data on the created object before calling the initialize methods in its class chain. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate(_:).
See Also
Working with Objects
JSObjectCallAsConstructor(_:_:_:_:_:)JSObjectCallAsFunction(_:_:_:_:_:_:)JSObjectCopyPropertyNames(_:_:)JSObjectDeleteProperty(_:_:_:_:)JSObjectGetPrivate(_:)JSObjectGetProperty(_:_:_:_:)JSObjectGetPropertyAtIndex(_:_:_:_:)JSObjectGetPrototype(_:_:)JSObjectHasProperty(_:_:_:)JSObjectIsConstructor(_:_:)JSObjectIsFunction(_:_:)JSObjectMakeArray(_:_:_:_:)JSObjectMakeConstructor(_:_:_:)JSObjectMakeDate(_:_:_:_:)JSObjectMakeError(_:_:_:_:)