UNPKG

667 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3function buildDelayFunction(delayOptions) {
4 var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d;
5 var baseDelay = jitter ? initial : initial / 2;
6 return function delayFunction(count) {
7 var delay = Math.min(max, baseDelay * Math.pow(2, count));
8 if (jitter) {
9 delay = Math.random() * delay;
10 }
11 return delay;
12 };
13}
14exports.buildDelayFunction = buildDelayFunction;
15//# sourceMappingURL=delayFunction.js.map
\No newline at end of file