pub type JSObjectConvertToTypeCallback = Option<unsafe extern "C-unwind" fn(JSContextRef, JSObjectRef, JSType, *mut JSValueRef) -> JSValueRef>;JSBase and JSObjectRef and JSValueRef only.Expand description
The callback invoked when converting an object to a particular JavaScript type.
Parameter ctx: The execution context to use.
Parameter object: The JSObject to convert.
Parameter type: A JSType specifying the JavaScript type to convert to.
Parameter exception: A pointer to a JSValueRef in which to return an exception, if any.
Returns: The objects’s converted value, or NULL if the object was not converted.
If you named your function ConvertToType, you would declare it like this:
JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception);
If this function returns false, the conversion request forwards to object’s parent class chain (which includes the default object class).
This function is only invoked when converting an object to number or string. An object converted to boolean is ‘true.’ An object converted to object is itself.
See also Apple’s documentation
Aliased Type§
pub enum JSObjectConvertToTypeCallback {
None,
Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, JSType, *mut *const OpaqueJSValue) -> *const OpaqueJSValue),
}Variants§
None
No value.
Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, JSType, *mut *const OpaqueJSValue) -> *const OpaqueJSValue)
Some value of type T.