Skip to content

Delay a promise a random amount of time set in the interval

License

Notifications You must be signed in to change notification settings

nlapshin/delay-random

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

delay-random

Delay a promise a random amount of time set in the interval

Install

$ npm i delay-random

Usage

const delayRandom = require('delay-random');

(async () => {
  const milliseconds = await delayRandom(1000, 1500);

  // Random integer value between numbers 1000 and 1500
  console.log(milliseconds)
})();

API

delay(minMilliseconds, maxMilliseconds)

Create a promise which resolves after the random set in the interval milliseconds.

minMilliseconds

Type: number

Starting range specified in milliseconds.

maxMilliseconds

Type: number

Ending range specified in milliseconds.

License

MIT © Nikolay Lapshin

About

Delay a promise a random amount of time set in the interval

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published