Contents

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 NULL to use the default object class.

  • data:

    A pointer to set as the object’s private data. Pass NULL to 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