Skip to content

Instantly share code, notes, and snippets.

@jackfranklin
Forked from remy/hang.js
Created November 30, 2012 14:44
Show Gist options
  • Save jackfranklin/4176179 to your computer and use it in GitHub Desktop.
Save jackfranklin/4176179 to your computer and use it in GitHub Desktop.
How to hang JavaScript (useful - to me - for slowing down code and testing)
function hang(n) {
var x = new XMLHttpRequest();
x.open('GET', 'http://hang.nodester.com/script.js?' + n, false);
x.send();
}
// usage: hang(2 * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment