Refactoring: re-enable caching

This commit is contained in:
Pieter Vander Vennet 2023-04-21 20:50:38 +02:00
parent 59544ec073
commit 476423f9d1
5 changed files with 19 additions and 3 deletions

View file

@ -240,6 +240,12 @@ export abstract class Store<T> implements Readable<T> {
return newSource
}
/**
* Converts the uiEventSource into a promise.
* The promise will return the value of the store if the given condition evaluates to true
* @param condition: an optional condition, default to 'store.value !== undefined'
* @constructor
*/
public AsPromise(condition?: (t: T) => boolean): Promise<T> {
const self = this
condition = condition ?? ((t) => t !== undefined)