Function

JSObjectMakeFunctionWithCallback

Convenience method for creating a JavaScript function with a given callback as its implementation.

Declaration

JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction);

Parameters

ctx

The execution context to use.

name

A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.

callAsFunction

The JSObjectCallAsFunctionCallback to invoke when the function is called.

Return Value

A JSObject that is a function. The object's prototype will be the default function prototype.

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