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
14 lines (13 loc) • 415 B
JavaScript
import { retry, retryAsync } from "../../retry";
export function retryAsyncDecorator(fn, retryOptions) {
return (...args) => {
const wrappedFn = () => fn(...args);
return retryAsync(wrappedFn, retryOptions);
};
}
export function retryDecorator(fn, retryOptions) {
return (...args) => {
const wrappedFn = () => fn(...args);
return retry(wrappedFn, retryOptions);
};
}