pub type JSObjectCallAsConstructorCallback = Option<unsafe extern "C" fn(ctx: JSContextRef, constructor: JSObjectRef, argumentCount: usize, arguments: *const JSValueRef, exception: *mut JSValueRef) -> *mut OpaqueJSValue>;Expand description
The callback invoked when an object is used as a constructor in a new expression.
ctx: The execution context to use.constructor: AJSObjectRefthat is the constructor being called.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 JSObjectRef that is the constructor’s return value.
If you named your function CallAsConstructor, you would declare it like this:
ⓘ
JSObjectRef
CallAsConstructor(JSContextRef ctx, JSObjectRef constructor,
size_t argumentCount, const JSValueRef arguments[],
JSValueRef* exception);If your callback were invoked by the JavaScript expression
new myConstructor(), constructor would be set to myConstructor.
If this callback is NULL, using your object as a constructor in a
new expression will throw an exception.
Aliased Type§
pub enum JSObjectCallAsConstructorCallback {
None,
Some(unsafe extern "C" fn(*const OpaqueJSContext, *mut OpaqueJSValue, usize, *const *const OpaqueJSValue, *mut *const OpaqueJSValue) -> *mut OpaqueJSValue),
}