setPropertyAtIndex method
Sets a property on an object by numeric index.
Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties.
propertyIndex
(unsigned) The property's name as a number.
value
(JSValueRef) A JSValue to use as the property's value.
exception
(JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
Implementation
void setPropertyAtIndex(int propertyIndex, JSValue value) {
final JSException exception = JSException.create(context);
JSObjectSetPropertyAtIndex(
context.ref,
_ref,
propertyIndex,
value.ref,
exception.ref,
);
if (exception.shouldThrow) throw exception.error;
}