Always returns the latest value emitted by the observable.
If you provide a [[BehaviorSubject]] the first returned value will be initialised with the observables current value (i.e. [[BehaviourSubject.getValue]]). This makes providing a default value in that case useless since it'll be overwritten. If you don't want this behaviour, please pipe your observable (this essentially converts it to a normal observable).
The latest value of the observable
Always returns the latest value emitted by the observable.
If you provide a [[BehaviorSubject]] the first returned value will be initialised with the observables current value (i.e. [[BehaviourSubject.getValue]]). This makes providing a default value in that case useless since it'll be overwritten. If you don't want this behaviour, please pipe your observable (this essentially converts it to a normal observable).
The latest value of the observable
Always returns the latest value emitted by the observable.
If you provide a [[BehaviorSubject]] the first returned value will be initialised with the observables current value (i.e. [[BehaviourSubject.getValue]]). This makes providing a default value in that case useless since it'll be overwritten. If you don't want this behaviour, please pipe your observable (this essentially converts it to a normal observable).
The latest value of the observable
Get the observable from a promise and return its current value
Get the observable from a promise and return its current value
Call the function once to get a promise returning an observable and return its current value .
Like calling:
const observable = usePromiseMemo(<func>, EMPTY);
const value = useObservable(observable, <defaultValue>);
This may seem like it is way too specific to be of any use but you'll find that a lot of Dolos is built using getter functions that asynchronously return observables.
Call the function once to get a promise returning an observable and return its current value .
Like calling:
const observable = usePromiseMemo(<func>, EMPTY);
const value = useObservable(observable, <defaultValue>);
This may seem like it is way too specific to be of any use but you'll find that a lot of Dolos is built using getter functions that asynchronously return observables.
Return the value of the resolved promise.
Return the value of the resolved promise.
Get the promise from a function and wait for it to resolve
Get the promise from a function and wait for it to resolve
Add a subscriber to an observable. Automatically unsubscribes.
Generated using TypeDoc
Dolos started using React Hooks! This module exposes some useful hooks when interacting with Dolos.
The following hooks aren't specific to Dolos! There are hooks specifically for Dolos, but you won't find them in here.
Most of these hooks alleviate working with observables, promises, or even the combination of the two.