Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js sleep

// sleep time expects milliseconds
function sleep (time) {
  return new Promise((resolve) => setTimeout(resolve, time));
}

// Usage!
sleep(500).then(() => {
    // Do something after the sleep!
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #sleep
ADD COMMENT
Topic
Name
9+7 =