MCPcopy Create free account
hub / github.com/UI5/webcomponents / set

Function set

packages/base/src/UI5Element.ts:1270–1304  ·  view source on GitHub ↗
(this: UI5Element, value: PropertyValue)

Source from the content-addressed store, hash-verified

1268 },
1269
1270 set(this: UI5Element, value: PropertyValue) {
1271 const ctor = this.constructor as typeof UI5Element;
1272 const oldState = origGet ? origGet.call(this) : this._state[prop];
1273
1274 const isDifferent = oldState !== value;
1275 if (isDifferent) {
1276 // if the decorator is on a setter, use it for storage
1277 if (origSet) {
1278 origSet.call(this, value);
1279 } else {
1280 this._state[prop] = value;
1281 }
1282 _invalidate.call(this, {
1283 type: "property",
1284 name: prop,
1285 newValue: value,
1286 oldValue: oldState,
1287 });
1288
1289 if (this._rendered) {
1290 // the component is already rendered, indicating it is not the constructor -
1291 // therefore the attribute can be set synchronously.
1292
1293 // get the effective value of the property,
1294 // as it might differ from the provided value
1295 const newValue = origGet ? origGet.call(this) : this._state[prop];
1296
1297 this._updateAttribute(prop, newValue);
1298 }
1299
1300 if (ctor.getMetadata().isFormAssociated()) {
1301 setFormValue(this as unknown as IFormInputElement);
1302 }
1303 }
1304 },
1305 });
1306 }
1307

Callers

nothing calls this directly

Calls 3

setFormValueFunction · 0.85
isFormAssociatedMethod · 0.80
getMetadataMethod · 0.80

Tested by

no test coverage detected