Skip to content
/ waiit Public

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

License

Notifications You must be signed in to change notification settings

Raju/waiit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published