setProperty method

void setProperty(
  1. String propertyName,
  2. JSValue value,
  3. JSPropertyAttributes attributes, {
  4. JSValuePointer? exception,
})

Sets a property on an object. propertyName A JSString containing the property's name. value A JSValueRef to use as the property's value. attributes (JSPropertyAttributes) A logically ORed set of JSPropertyAttributes to give to the property. 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 setProperty(
  String propertyName,
  JSValue value,
  JSPropertyAttributes attributes, {
  JSValuePointer? exception,
}) {
  JSObjectRef.jSObjectSetProperty(
      context.pointer,
      pointer,
      JSString.fromString(propertyName).pointer,
      value.pointer,
      jSPropertyAttributesToCEnum(attributes),
      (exception ?? JSValuePointer(nullptr)).pointer);
}