ADVANCED FEATURE
Use this when piping values to another existing ObservableValue
like:
getUserRunner = new AsyncActionRunner<User, null>(null);
userName = new ObservableValue<string, null>(null);
constructor() {
this.getUserRunner.valueSubject
.pipe(map(user => user.name))
.subscribe(this.userName.getObserver()); <----- You can pipe values to another ObservableValue.
}
Easier way to pipe from one ObservableValue to another through rxjs operators.
Example (inside a mediator/class):
readonly elapsedThrottledSeconds = ObservableValue.from(
this.elapsedSeconds.valueSubject.pipe(throttleTime(200)),
this.elapsedSeconds.getValue()
);
any Observable (generally from a rxjs pipe though)
Generated using TypeDoc
ObservableValue class stores a value and notifies interested parties when the value changes.
This is often used as a property on a class that other classes may be interested in.
Because this is used as a complex property of sorts. It would need some of the functionality of getters and setters, namely: public get, public set, or public get, private set,
The default behavior of ObservableValues gives you the public getter and public setter.
If you want to make the setter private you can supply the key at construction, and this will make the setter need a key to set the value or the error.