Type Alias

JSObjectHasPropertyCallback

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

Declaration

typealias JSObjectHasPropertyCallback = (JSContextRef?, JSObjectRef?, JSStringRef?) -> Bool

Parameters

ctx

The execution context to use.

object

The JSObject to search for the property.

propertyName

A JSString containing the name of the property look up.

Return Value

true if object has the property, otherwise false.

Discussion

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

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 JSObjectGetPropertyNamesCallback

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

typealias JSObjectHasInstanceCallback

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

typealias JSObjectInitializeCallback

The callback invoked when an object is first created.

typealias JSObjectSetPropertyCallback

The callback invoked when setting a property’s value.