setPropertyAtIndex method

void setPropertyAtIndex(
  1. int propertyIndex,
  2. JSValue value, {
  3. JSValuePointer? exception,
})

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, {
  JSValuePointer? exception,
}) {
  JSObjectRef.jSObjectSetPropertyAtIndex(
      context.pointer,
      pointer,
      propertyIndex,
      value.pointer,
      (exception ?? JSValuePointer(nullptr)).pointer);
}