random-set-interval

1.0.1 • Public • Published

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()
 });

Package Sidebar

Install

npm i random-set-interval

Weekly Downloads

36

Version

1.0.1

License

MIT

Unpacked Size

6.14 kB

Total Files

10

Last publish

Collaborators

  • aankur