JSObjectGetPropertyCallback

Type Alias JSObjectGetPropertyCallback 

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

The callback invoked when getting a property’s value.

Parameter ctx: The execution context to use.

Parameter object: The JSObject to search for the property.

Parameter propertyName: A JSString containing the name of the property to get.

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

Returns: The property’s value if object has the property, otherwise NULL.

If you named your function GetProperty, you would declare it like this:

JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);

If this function returns NULL, the get request forwards to object’s statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.

See also Apple’s documentation

Aliased Type§

pub enum JSObjectGetPropertyCallback {
    None,
    Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSString, *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 OpaqueJSString, *mut *const OpaqueJSValue) -> *const OpaqueJSValue)

Some value of type T.