JSObjectCallAsFunctionCallback

Type Alias JSObjectCallAsFunctionCallback 

Source
pub type JSObjectCallAsFunctionCallback = Option<unsafe extern "C-unwind" fn(JSContextRef, JSObjectRef, JSObjectRef, usize, *mut JSValueRef, *mut JSValueRef) -> JSValueRef>;
Available on crate features JSBase and JSObjectRef only.
Expand description

The callback invoked when an object is called as a function.

Parameter ctx: The execution context to use.

Parameter function: A JSObject that is the function being called.

Parameter thisObject: A JSObject that is the ‘this’ variable in the function’s scope.

Parameter argumentCount: An integer count of the number of arguments in arguments.

Parameter arguments: A JSValue array of the arguments passed to the function.

Parameter exception: A pointer to a JSValueRef in which to return an exception, if any.

Returns: A JSValue 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.

See also Apple’s documentation

Aliased Type§

pub enum JSObjectCallAsFunctionCallback {
    None,
    Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSValue, usize, *mut *const OpaqueJSValue, *mut *const OpaqueJSValue) -> *const OpaqueJSValue),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSValue, usize, *mut *const OpaqueJSValue, *mut *const OpaqueJSValue) -> *const OpaqueJSValue)

Some value of type T.