Function
trySet (root, path, value) public
| Module: | @ember/object |
|---|
Defined in packages/@ember/-internals/metal/lib/property_set.ts:129
import { trySet } from '@ember/object'; - root
- Object
- The object to modify.
- path
- String
- The property path to set
- value
- Object
- The value to set
Error-tolerant form of set. Will not blow up if any part of the chain is undefined, null, or destroyed.
This is primarily used when syncing bindings, which may try to update after an object has been destroyed.
import { trySet } from '@ember/object';
let obj = { name: "Zoey" };
trySet(obj, "contacts.twitter", "@emberjs");
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/3.25/functions/@ember%2Fobject/trySet