@nethesis/phone-island
Version:
NethVoice CTI Phone Island
3 lines (2 loc) • 660 B
JavaScript
;function t(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Object.defineProperty(exports,"__esModule",{value:!0}),t.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var i=Math.random(),e=Math.floor(i*this.jitter*t);t=1&Math.floor(10*i)?t+e:t-e}return 0|Math.min(t,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(t){this.ms=t},t.prototype.setMax=function(t){this.max=t},t.prototype.setJitter=function(t){this.jitter=t},exports.Backoff=t;
//# sourceMappingURL=backo2.js.map