Delays the execution of an asynchronous function.
async
function, by putting it to sleep, returning a Promise
.const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
async function sleepyWork() {
console.log("I'm going to sleep for 1 second.");
await sleep(1000);
console.log('I woke up after 1 second.');
}
JavaScript, Function
Performs left-to-right function composition for asynchronous functions.
JavaScript, Function
Converts an asynchronous function to return a promise.
JavaScript, Function
Chains asynchronous functions.