computed-async-mobx
Version:
Define a computed by returning a Promise
14 lines (13 loc) • 682 B
TypeScript
import { PromisedComputedValue } from "./promisedComputed";
/**
* Composition of promisedComputed and throttledComputed, so performs
* conversion of a promised value into a plain value and also waits for
* the specified minimum delay before launching a new promise in response
* to changes.
*
* @param init Value to assume until the promise first resolves
* @param delay Minimum time to wait between creating new promises
* @param compute Evaluates to a promised or plain value
* @param name (optional) For MobX debug purposes
*/
export declare function asyncComputed<T>(init: T, delay: number, compute: () => T | PromiseLike<T>, name?: string): PromisedComputedValue<T>;