Type Alias

JSObjectGetPropertyCallback

The callback invoked when getting a property’s value.

Declaration

typedef JSValueRef (*JSObjectGetPropertyCallback)(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception);

Parameters

ctx

The execution context to use.

object

The JSObject to search for the property.

propertyName

A JSString containing the name of the property to get.

exception

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

Return Value

The property's value if the object has the property, otherwise NULL.

Discussion

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

JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);

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

See Also

Callbacks

JSObjectCallAsConstructorCallback

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

JSObjectCallAsFunctionCallback

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

JSObjectConvertToTypeCallback

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

JSObjectDeletePropertyCallback

The callback invoked when deleting a property.

JSObjectFinalizeCallback

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

JSObjectGetPropertyNamesCallback

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

JSObjectHasInstanceCallback

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

JSObjectHasPropertyCallback

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

JSObjectInitializeCallback

The callback invoked when an object is first created.

JSObjectSetPropertyCallback

The callback invoked when setting a property’s value.