pub unsafe extern "C" fn JSObjectMakeFunctionWithCallback(
ctx: JSContextRef,
name: JSStringRef,
callAsFunction: JSObjectCallAsFunctionCallback,
) -> JSObjectRef
Expand description
Convenience method for creating a JavaScript function with a given callback as its implementation.
ctx
: The execution context to use.name
: AJSStringRef
containing the function’s name. This will be used when converting the function to string. PassNULL
to create an anonymous function.callAsFunction
: TheJSObjectCallAsFunctionCallback
to invoke when the function is called.
Returns a JSObjectRef
that is a function. The object’s prototype will be
the default function prototype.