@spa-tools/utilities
sleep()
The sleep() function returns a promise that will be resolved after provided
number of milliseconds to delay execution withn an async flow.
Usage
import { sleep } from '@spa-tools/utilities';
async function main() {
  console.log('Hello');
  await sleep(1000);
  console.log('World');
}
console.log('Start');
await main();
console.log('End');
// above calls result in:
// --> Start
// --> Hello
// pause for 1 second
// --> World
// --> End
Arguments
| Name | Type | Description | 
|---|---|---|
ms | number | The number of milliseconds to sleep | 
Returns
Returns a Promise.