Creates an instance of AtomWatcher.
let w = new AtomWatcher(this, x => x.data.fullName = `${x.data.firstName} ${x.data.lastName}`);
You must dispose w
in order to avoid memory leaks.
Above method will set fullName whenever, data or its firstName,lastName property is modified.
AtomWatcher will assign null if any expression results in null in single property path.
In order to avoid null, you can rewrite above expression as,
let w = new AtomWatcher(this,
x => {
if(x.data.firstName && x.data.lastName){
x.data.fullName = `${x.data.firstName} ${x.data.lastName}`
}
});
Target on which watch will be set to observe given set of properties
Path is either lambda expression or array of property path to watch, if path was lambda, it will be executed when any of members will modify
This function will be executed when any member in path is updated
If path was given as an array of string property path, you can use this func
that will be executed
when any of property is updated.
You must manually invoke evaluate after setting this property.
This will dispose and unregister all watchers
Initialize the path targets
if true, evaluate entire watch expression and run onChange method
Generated using TypeDoc
AtomWatcher
{IDisposable}
T