npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

yoctodelay

1.1.0 • Public • Published

yoctodelay Build Status

Delay a promise a specified amount of time

It's less than half the size of the nanodelay module.

Install

$ npm install yoctodelay

Usage

const delay = require('yoctodelay');
 
(async () => {
    foo();
 
    await delay(100);
 
    // Executed 100 milliseconds later
    bar();
})();

API

delay(ms)

Delay the promise and then resolve.

ms

Type: number

Milliseconds to delay the promise.

FAQ

What is yocto?

It's the smallest official unit prefix in the metric system. Much smaller than nano.

Is this a joke?

Partly. The nanodelay module was created only because the delay module is a tiny bit larger. Well, this module is a tiny bit smaller than the nanodelay module. Comparing size at the byte level is super silly. It doesn't matter unless the difference is more than many kilobytes. This is still a fully working module though. Go ahead and use it.

Related

  • delay - Similar to this module but with more features
  • More…

License

MIT © Sindre Sorhus

install

npm i yoctodelay

Downloadsweekly downloads

30

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability