@tangany/waas
Version:
node.js SDK for Tangany Wallet as a Service API
10 lines (9 loc) • 725 B
TypeScript
/**
* Executes the passed function until the defined result occurs or the timeout is exceeded.
* @param fn - Function that executes the polling logic (for example, an API call)
* @param validationFn - Function that defines which result of a polling call should lead to the end of polling
* @param description - Summary of the polling activity for the error message on timeout (e.g. "request 12345")
* @param timeout - Limit value after which polling is aborted (in ms)
* @param pollingInterval - Delay between the individual polling calls (in ms)
*/
export declare function poll<T>(fn: () => Promise<T>, validationFn: (result: T) => boolean, description: string, timeout: number, pollingInterval: number): Promise<T>;