setProperty method
void
setProperty(
- String propertyName,
- JSValue? value, {
- JSPropertyAttributes attributes = JSPropertyAttributes.kJSPropertyAttributeNone,
Implementation
void setProperty(String propertyName, JSValue? value, {JSPropertyAttributes attributes = JSPropertyAttributes.kJSPropertyAttributeNone}) {
final JSException exception = JSException.create(_context);
final JSString jsPropertyName = JSString.fromString(propertyName);
try {
js_bd.JSObjectSetProperty(_context.ref, _ref, jsPropertyName.ref, value?.ref ?? nullptr, JSPropertyAttributes.values.indexOf(attributes), exception.ref);
if (exception.shouldThrow) {
throw exception.error;
}
} finally {
jsPropertyName.release();
exception.release();
}
}