Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js sleep sync

function wait(ms) {
    const start = Date.now();
	let now = start;
    while ( (now - start) < ms ) { now = Date.now(); }
}

// Usage:
console.log("Before wait...");
wait(5000);
console.log("After 5 seconds...");
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #sleep #sync
ADD COMMENT
Topic
Name
7+5 =