Answers for "nodejs wait for async function"

0

node js async delay

const { promisify } = require('util');

const delay = promisify(setTimeout);

// Usage:
(async () => {
  console.log('1');
  await delay(1000);
  console.log('2');
})();
Posted by: Guest on August-18-2020
0

javascript wait async

await Promise(resolve => setTimeout(resolve, ms));
Posted by: Guest on October-12-2021

Code answers related to "nodejs wait for async function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language