Skip to content

Instantly share code, notes, and snippets.

@killtheliterate
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save killtheliterate/d79ff4723e8db2fb75b4 to your computer and use it in GitHub Desktop.
Save killtheliterate/d79ff4723e8db2fb75b4 to your computer and use it in GitHub Desktop.
(function loop() {
var rand = Math.round(Math.random() * 1000 * 1000);
console.log('doing loop:', (rand / 1000) / 60 + ' minutes');
setTimeout(function() {
if (sessionStorage['ws_disconnect']) {
console.log('reconnect');
delete sessionStorage['ws_disconnect'];
} else {
console.log('disconnect');
sessionStorage['ws_disconnect'] = true;
}
loop();
}, rand);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment