JSObjectMakeFunctionWithCallback top-level property
JSObjectRef Function(JSContextRef ctx, JSStringRef name, Pointer<NativeFunction<JSObjectCallAsFunctionCallback_> > callAsFunction)
JSObjectMakeFunctionWithCallback
final
Convenience method for creating a JavaScript function with a given callback as its implementation.
ctx
(JSContextRef) The execution context to use.
name
(JSStringRef) 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
(JSObjectCallAsFunctionCallback) The JSObjectCallAsFunctionCallback to invoke when the function is called.
@result
(JSObjectRef) A JSObject that is a function. The object's prototype will be the default function prototype.
Implementation
final JSObjectRef Function(
JSContextRef ctx,
JSStringRef name,
Pointer<NativeFunction<JSObjectCallAsFunctionCallback_>> callAsFunction,
)
JSObjectMakeFunctionWithCallback =
kLookup<
NativeFunction<
JSObjectRef Function(
JSContextRef,
JSStringRef,
Pointer<NativeFunction<JSObjectCallAsFunctionCallback_>>,
)
>
>('JSObjectMakeFunctionWithCallback').asFunction();