Type Alias


The callback invoked when setting a property’s value.


typealias JSObjectSetPropertyCallback = (JSContextRef?, JSObjectRef?, JSStringRef?, JSValueRef?, UnsafeMutablePointer<JSValueRef?>?) -> Bool



The execution context to use.


The JSObject on which to set the property's value.


A JSString containing the name of the property to set.


A JSValue to use as the property's value.


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

Return Value

true if the property was set, otherwise false.


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

bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);

If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class).

See Also


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 JSObjectHasPropertyCallback

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

typealias JSObjectInitializeCallback

The callback invoked when an object is first created.