pub type JSObjectCallAsFunctionCallback = Option<unsafe extern "C" fn(ctx: JSContextRef, function: JSObjectRef, thisObject: JSObjectRef, argumentCount: usize, arguments: *const JSValueRef, exception: *mut JSValueRef) -> *const OpaqueJSValue>;Expand description
The callback invoked when an object is called as a function.
ctx: The execution context to use.function: AJSObjectRefthat is the function being called.thisObject: AJSObjectRefthat is thethisvariable in the function’s scope.argumentCount: An integer count of the number of arguments inarguments.arguments: AJSValueRefarray of the arguments passed to the function.exception: A pointer to aJSValueRefin which to return an exception, if any.
Returns a JSValueRef that is the function’s return value.
If you named your function CallAsFunction, you would declare it like this:
ⓘ
JSValueRef
CallAsFunction(JSContextRef ctx, JSObjectRef function,
JSObjectRef thisObject,
size_t argumentCount, const JSValueRef arguments[],
JSValueRef* exception);If your callback were invoked by the JavaScript expression
myObject.myFunction(), function would be set to myFunction,
and thisObject would be set to myObject.
If this callback is NULL, calling your object as a function
will throw an exception.
Aliased Type§
pub enum JSObjectCallAsFunctionCallback {
None,
Some(unsafe extern "C" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSValue, usize, *const *const OpaqueJSValue, *mut *const OpaqueJSValue) -> *const OpaqueJSValue),
}