@newdash/newdash
Version:
javascript/typescript utility library
15 lines (14 loc) • 678 B
TypeScript
import { GeneralFunction } from "./types";
/**
* make function retry-able
*
* e.g. if `maxRetryCount` is 3, it will run 3 times at most (include the first one), and return the final error.
*
* @since 5.14.0
* @category Async
* @param runner async function, return promise
* @param maxRetryCount the maximum number of times a runner should retry, default is 3
* @param retryAfterMSecond (async function required, for sync function, this parameter will not be applied) the wait milliseconds before retry, default is zero
*/
export declare function retry<T extends GeneralFunction>(runner: T, maxRetryCount?: number, retryAfterMSecond?: number): T;
export default retry;