Answers for "settimeout wait"

1

await setTimeout

function timeout(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}
async function sleep(fn, ...args) {
    await timeout(3000);
    return fn(...args);
}
Posted by: Guest on November-26-2020
1

javascript sleep settimeout

setTimeout(() => {  console.log("World!"); }, 2000);
Posted by: Guest on March-13-2020
0

js settimeout wait element

var checkExist = setInterval(function() {
   if ($('#the-canvas').length) {
      console.log("Exists!");
      clearInterval(checkExist);
   }
}, 100); // check every 100ms
Posted by: Guest on October-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language