Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript async delay

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

(async () => {
  console.log('1');
  await delay(1000);
  console.log('2');
})();
Comment

javascript wait async

await Promise(resolve => setTimeout(resolve, ms));
Comment

node js async delay

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

const delay = promisify(setTimeout);

// Usage:
(async () => {
  console.log('1');
  await delay(1000);
  console.log('2');
})();
Comment

PREVIOUS NEXT
Code Example
Javascript :: objectid is not defined node js mongodb 
Javascript :: javascript random color generator 
Javascript :: TypeError: expressGraphQL is not a function 
Javascript :: javascript replace line breaks with br 
Javascript :: check device width using js 
Javascript :: model show in jquery 
Javascript :: how to wait 1 second in javascript 
Javascript :: disable textbox jquery 
Javascript :: add site url validation regex 
Javascript :: trigger a click on page load jquery 
Javascript :: jquery pause n seconds 
Javascript :: explode in jquery 
Javascript :: disable all element in div angular 12 
Javascript :: mongoose nestjs installation 
Javascript :: js if not undefined 
Javascript :: express req ip address 
Javascript :: get meta content jquery 
Javascript :: regular expression to remove empty lines after text 
Javascript :: js local storage delete key 
Javascript :: showing difference between dates in minutes js 
Javascript :: ready function jquery 
Javascript :: allow cross origin node 
Javascript :: use application/x-www-form-urlencoded in javascript 
Javascript :: Could not resolve dependency: peer react@"^18.2.0" from react-dom@18.2.0 
Javascript :: JS get random number between 
Javascript :: how to get name array value in jquery 
Javascript :: select element by id js 
Javascript :: autocomplete off using jquery 
Javascript :: get browser language 
Javascript :: jquery add option to select 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =