pub unsafe extern "C-unwind" fn JSObjectMakeFunctionWithCallback(
ctx: JSContextRef,
name: JSStringRef,
call_as_function: JSObjectCallAsFunctionCallback,
) -> JSObjectRefAvailable on crate features
JSBase and JSObjectRef 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.
§Safety
ctxmust be a valid pointer.namemust be a valid pointer.call_as_functionmust be implemented correctly.