JSObjectSetPropertyCallback

Type Alias JSObjectSetPropertyCallback 

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

The callback invoked when setting a property’s value.

Parameter ctx: The execution context to use.

Parameter object: The JSObject on which to set the property’s value.

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

Parameter value: A JSValue to use as the property’s value.

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

Returns: true if the property was set, otherwise false.

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

bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);

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

See also Apple’s documentation

Aliased Type§

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

Variants§

§1.0.0

None

No value.

§1.0.0

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

Some value of type T.