Last active
March 12, 2017 15:57
-
-
Save sparr/4a56238e233d14470d7b7c0211a9bdb2 to your computer and use it in GitHub Desktop.
clear active timers 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
for (handle of process._getActiveHandles()) { | |
// if (handle instanceof Timer) { // doesn't work because Timer isn't defined, even though handle.constructor.name=="Timer" | |
if ('_list' in handle) { | |
for (timername in handle._list) { | |
clearTimeout(handle._list[timername]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment