JSObjectSetPropertyCallback
The callback type for setting a property’s value.
Declaration
typealias JSObjectSetPropertyCallback = (JSContextRef?, JSObjectRef?, JSStringRef?, JSValueRef?, UnsafeMutablePointer<JSValueRef?>?) -> BoolParameters
- ctx:
The execution context to use.
- object:
The Jsobjectref to set the property’s value on.
- propertyName:
A Jsstringref that contains the name of the property to set.
- value:
A Jsvalueref to use as the property’s value.
- exception:
A pointer to a Jsvalueref to return an exception in, if any.
Return Value
Discussion
If you name your function SetProperty, you 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 the object’s statically declared properties, and then its parent class chain (which includes the default object class).