All Projects → wesbos → Waait

wesbos / Waait

Licence: mit
waait!

Programming Languages

javascript
184084 projects - #8 most used programming language

build status

Waait

Hold on a sec, or 7.

wait() Returns a promise that resolves after how many milliseconds you pass it.

Great for waiting any amount of time. If you do not pass it any value, it will immediately resolve. This is handy when you need to ensure the following code is put at the end of the JS event callstack.

Usage

import wait from 'waait';

async function doStuff() {
  doSomething();
  await wait();
  doSomethingElse();
  await wait(200);
  console.log('200ms later');
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].