Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript wait 5 sec

function stateChange(newState) {
    setTimeout(function () {
        if (newState == -1) {
            alert('VIDEO HAS STOPPED');
        }
    }, 5000);
}
Comment

js wait 5 second

function sleep(num) {
	let now = new Date();
	const stop = now.getTime() + num;
	while(true) {
		now = new Date();
		if(now.getTime() > stop) return;
	}
}

sleep(1000)
console.log('delay 1 second');
Comment

PREVIOUS NEXT
Code Example
Javascript :: js check if date is today 
Javascript :: connection refused xmlhttprequest 
Javascript :: jqiery call onclick in another element 
Javascript :: javascript go back to last page 
Javascript :: html how to remove attribute# 
Javascript :: javascript get all elements with class 
Javascript :: gradlew clean in react native 
Javascript :: jquery get element id 
Javascript :: history.push in nextjs 
Javascript :: jquery set select readonly 
Javascript :: display pm or am on date js 
Javascript :: javascript preload images 
Javascript :: js startswith 
Javascript :: user agent chrome 
Javascript :: cut text if too long javascript 
Javascript :: get localstorage 
Javascript :: username validation in javascript 
Javascript :: generate random ip address javascript 
Javascript :: javascript foreach key value 
Javascript :: setinterval in angular 6 
Javascript :: change onclick attribute with javascrip 
Javascript :: remove all dots from string javascript 
Javascript :: await settimeout 
Javascript :: js is directory 
Javascript :: react native display inline block 
Javascript :: collision circle 
Javascript :: center image jsx css 
Javascript :: create react app node 12 
Javascript :: get pods on specific node 
Javascript :: textField space between text flutter 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =