ts-retry
Version:
A little retry tool to execute a function until the function is successful. Can also bind a timeout to a function. This lib is usable in typescript, in javascript, in node, in SPA tools (rest, Vue, Svelte...) and browser (available in ESM and common js fo
15 lines (14 loc) • 462 B
JavaScript
export const defaultDelay = 250;
export const defaultMaxTry = 4 * 60;
export let defaultRetryOptions = {
delay: defaultDelay,
maxTry: defaultMaxTry,
until: null,
};
export function setDefaultRetryOptions(retryOptions) {
defaultRetryOptions = Object.assign(Object.assign({}, defaultRetryOptions), retryOptions);
return getDefaultRetryOptions();
}
export function getDefaultRetryOptions() {
return Object.assign({}, defaultRetryOptions);
}