Creates a JavaScript object.


JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void *data);



The execution context to use.


The JSClass to assign to the object. Pass NULL to use the default object class.


A void* to set as the object's private data. Pass NULL to specify no private data.

Return Value

A JSObject with the given class and private data.


The default object class does not 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.

data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software