Answers for "delay in node"

2

sleep in nodejs?

await sleep(1000)
function sleep(ms) {
  return new Promise((resolve) => {
    setTimeout(resolve, ms);
  });
}
Posted by: Guest on July-18-2020
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
-1

node scripts delay

"scripts": {  "test:system": "npm-run-all build -p -r serve test",  "build": "webpack",  "serve": "serve -p 8000",  "test": "wait-on http://localhost:8001 && npm run test:codecept",  "test:codecept": "codecept",}
Posted by: Guest on July-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language