Type Definition javascriptcore_sys::JSObjectConvertToTypeCallback [] [src]

type JSObjectConvertToTypeCallback = Option<unsafe extern "C" fn(_: JSContextRef, _: JSObjectRef, _: JSType, _: *mut JSValueRef) -> *const OpaqueJSValue>;

The callback invoked when converting an object to a particular JavaScript type.

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.