Created
November 30, 2015 19:07
-
-
Save jscari/89c4c4fbfde66ade7ad8 to your computer and use it in GitHub Desktop.
Stop all timeouts in Javascript
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
// 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