Non blocking asynchronous sleep. Due the nature of javascript an the event loop, it suspends the current function execution only. It does not pause the entire program execution.
npm install --save @react-corekit/sleepyarn add @react-corekit/sleepawait sleep(n);
// Do somethingsleep(n).then(() => {
// Do something
});import sleep from '@react-corekit/sleep';
async function run() {
/* wait one second before
contitue this function execution */
await sleep(1000);
}
run();Async functions - making promises friendly
MIT © glongh