pub type JSObjectHasPropertyCallback = Option<unsafe extern "C-unwind" fn(JSContextRef, JSObjectRef, JSStringRef) -> bool>;JSBase and JSObjectRef only.Expand description
The callback invoked when determining whether an object has a property.
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 look up.
Returns: true if object has the property, otherwise false.
If you named your function HasProperty, you would declare it like this:
bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
If this function returns false, the hasProperty request forwards to object’s statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.
This callback enables optimization in cases where only a property’s existence needs to be known, not its value, and computing its value would be expensive.
If this callback is NULL, the getProperty callback will be used to service hasProperty requests.
See also Apple’s documentation
Aliased Type§
pub enum JSObjectHasPropertyCallback {
None,
Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSString) -> bool),
}Variants§
None
No value.
Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSString) -> bool)
Some value of type T.