pub unsafe extern "C-unwind" fn JSObjectMakeFunctionWithCallback(
ctx: JSContextRef,
name: JSStringRef,
call_as_function: JSObjectCallAsFunctionCallback,
) -> JSObjectRef
Available on crate features
JSObjectRef
and JSBase
only.Expand description
Convenience method for creating a JavaScript function with a given callback as its implementation.
Parameter ctx
: The execution context to use.
Parameter 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.
Parameter callAsFunction
: The JSObjectCallAsFunctionCallback to invoke when the function is called.
Returns: A JSObject that is a function. The object’s prototype will be the default function prototype.