1.0.0 • Published 5 years ago

waiit v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

waiit

Wait for any amount of time in milliseconds or resolve immediately if no value passed.

Support

    NodeJS     :heavy_check_mark:

    Browser     :x:

Install

npm i waiit

Example

wait() // Returns a promise that resolves immediately
wait(5000) // Returns a promise that resolves after 5sec

Usage

const wait = require ( `waiit` );

const doSomething = async () => {
  console.log ( `Start` );

  await wait ( 5000 );
  console.log ( `Wait` );

  await wait ();
  console.log ( `Finish` );
};

doSomething ();