Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 609 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 609 Bytes

waiit

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

Support

    NodeJS     ✔️

    Browser     ❌

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