1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function 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 | }
|
14 | exports.buildDelayFunction = buildDelayFunction;
|
15 |
|
\ | No newline at end of file |