-
-
Save tenntenn/9580092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
var TIMEOUT = 1* 1000; | |
setTimeout(function() { | |
if (document.readyState === 'complete') { | |
return; | |
} | |
alert('timeout!'); | |
}, TIMEOUT); | |
document.addEventListener('readystatechange', function() { | |
console.log(document.readyState); | |
}, false); | |
</script> | |
</head> | |
<body> | |
<script> | |
console.log('start'); | |
var STOP = 5 * 1000; | |
var before = new Date().getTime(); | |
while(true) { | |
if (new Date().getTime() - before > STOP) { | |
break; | |
} | |
} | |
console.log('done'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment