JSObjectGetPropertyNamesCallback

Type Alias JSObjectGetPropertyNamesCallback 

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

The callback invoked when collecting the names of an object’s properties.

Parameter ctx: The execution context to use.

Parameter object: The JSObject whose property names are being collected.

Parameter propertyNames: A JavaScript property name accumulator in which to accumulate the names of object’s properties.

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

void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);

Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for…in loops.

Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class’s getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object’s prototype, are added independently.

See also Apple’s documentation

Aliased Type§

pub enum JSObjectGetPropertyNamesCallback {
    None,
    Some(unsafe extern "C-unwind" fn(*const OpaqueJSContext, *mut OpaqueJSValue, *mut OpaqueJSPropertyNameAccumulator)),
}

Variants§

§1.0.0

None

No value.

§1.0.0

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

Some value of type T.