Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js sync delay

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 #sync #delay
ADD COMMENT
Topic
Name
9+2 =