Type Alias

JSObjectGetPropertyNamesCallback

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

Declaration

typealias JSObjectGetPropertyNamesCallback = (JSContextRef?, JSObjectRef?, JSPropertyNameAccumulatorRef?) -> Void

Parameters

ctx

The execution context to use.

object

The JSObject whose property names are being collected.

accumulator

A JavaScript property name accumulator in which to accumulate the names of object's properties.

Discussion

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

Callbacks

typealias JSObjectCallAsConstructorCallback

The callback invoked when an object is used as a constructor in a 'new' expression.

typealias JSObjectCallAsFunctionCallback

The callback invoked when an object is called as a function.

typealias JSObjectConvertToTypeCallback

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

typealias JSObjectDeletePropertyCallback

The callback invoked when deleting a property.

typealias JSObjectFinalizeCallback

The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.

typealias JSObjectGetPropertyCallback

The callback invoked when getting a property’s value.

typealias JSObjectHasInstanceCallback

hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.

typealias JSObjectHasPropertyCallback

The callback invoked when determining whether an object has a property.

typealias JSObjectInitializeCallback

The callback invoked when an object is first created.

typealias JSObjectSetPropertyCallback

The callback invoked when setting a property’s value.