async-wrappers
Version:
A set of wrapper functions to perform debouncing, throttling, retrying etc.
27 lines (26 loc) • 552 B
TypeScript
/**
* Used to hold a pending result
* @internal
*/
export interface Pending<T> {
/**
* Holds the promise that will resolve with the result value.
*/
promise: Promise<T>;
/**
* Indicate an error occurred
* @param err
*/
error(err?: any): Promise<T>;
/**
* complete the result
* @param result the final result
*/
complete(result: T | PromiseLike<T>): Promise<T>;
}
/**
* create a waiting empty result
* @internal
*/
declare const pending: <T>() => Pending<T>;
export default pending;