Skip to content

Instantly share code, notes, and snippets.

@jscari
Created November 30, 2015 19:07
Show Gist options
  • Save jscari/89c4c4fbfde66ade7ad8 to your computer and use it in GitHub Desktop.
Save jscari/89c4c4fbfde66ade7ad8 to your computer and use it in GitHub Desktop.
Stop all timeouts in Javascript
// Set a fake timeout to get the highest timeout id
var highestTimeoutId = setTimeout(";");
// clear all timeouts with an id between 0 and highestTimeoutId
for (var i = 0 ; i < highestTimeoutId ; i++) {
clearTimeout(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment