UNPKG

@segment/analytics-next

Version:

Analytics Next (aka Analytics 2.0) is the latest version of Segment’s JavaScript SDK - enabling you to send your data to any tool without having to learn, test, or use a new API every time.

10 lines 530 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.backoff = void 0; function backoff(params) { var random = Math.random() + 1; var _a = params.minTimeout, minTimeout = _a === void 0 ? 500 : _a, _b = params.factor, factor = _b === void 0 ? 2 : _b, attempt = params.attempt, _c = params.maxTimeout, maxTimeout = _c === void 0 ? Infinity : _c; return Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout); } exports.backoff = backoff; //# sourceMappingURL=backoff.js.map