Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sleep js

function sleepFor( sleepDuration ){
    var now = new Date().getTime();
    while(new Date().getTime() < now + sleepDuration){ /* do nothing */ } 
}

// Use like so:

sleepFor(1000)
alert("hi")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sleep #js
ADD COMMENT
Topic
Name
2+5 =