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
18 lines (17 loc) • 587 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.retryAsyncDecorator = retryAsyncDecorator;
exports.retryDecorator = retryDecorator;
const retry_1 = require("../../retry");
function retryAsyncDecorator(fn, retryOptions) {
return (...args) => {
const wrappedFn = () => fn(...args);
return (0, retry_1.retryAsync)(wrappedFn, retryOptions);
};
}
function retryDecorator(fn, retryOptions) {
return (...args) => {
const wrappedFn = () => fn(...args);
return (0, retry_1.retry)(wrappedFn, retryOptions);
};
}