Created
November 30, 2012 13:23
-
-
Save remy/4175723 to your computer and use it in GitHub Desktop.
How to hang JavaScript (useful - to me - for slowing down code and testing)
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
function hang(n) { | |
var x = new XMLHttpRequest(); | |
x.open('GET', 'http://hang.nodester.com/script.js?' + n, false); | |
x.send(); | |
} | |
// usage: hang(2 * 1000); |
It is cool, ha.
that website is down :(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Totally non-essential, but I saw Paul Irish denote seconds as milliseconds by doing
2e3
rather than2 * 1000
which I thought was pretty cool.