1.0.1 • Published 1 year ago

random-set-interval v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

random-set-interval

Random Set Interval/Delay, updates setInterval to provide a randomized delay in between invocations, useful for API/Limiting/Throttling

Usage:-

npm install random-set-interval

//commonjs
const RandomTimeInterval = require('random-set-interval');
//esm
import RandomTimeInterval from 'random-set-interval';
Usage
 const randomTimeInterval = new RandomTimeInterval(60 * 5 /* fixed delay in seconds */, 30 /* random delay in seconds */);
 randomTimeInterval.on('tick', () => {
    //will be called repeatedly until randomTimeInterval.close()
 });