Created
March 16, 2014 08:23
-
-
Save anonymous/9580089 to your computer and use it in GitHub Desktop.
This file contains hidden or 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