eas-cli
Version:
EAS command line tool
22 lines (21 loc) • 651 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.retryIfNullAsync = exports.waitAsync = void 0;
async function waitAsync(duration) {
await new Promise(resolve => setTimeout(resolve, duration));
}
exports.waitAsync = waitAsync;
async function retryIfNullAsync(method, options = {}) {
let { tries = 5, delay = 1000 } = options;
while (tries > 0) {
const value = await method();
if (value !== null) {
return value;
}
tries--;
options.onRetry?.(tries);
await waitAsync(delay);
}
return null;
}
exports.retryIfNullAsync = retryIfNullAsync;
;