Created
February 26, 2016 07:23
-
-
Save stansidel/e0f5611a79f57a177b89 to your computer and use it in GitHub Desktop.
Script allows for watching JavaScript timeouts (intervals, timers) being created and cleared. Useful in debugging purposes.
This file contains hidden or 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
window.originalSetTimeout=window.setTimeout; | |
window.originalClearTimeout=window.clearTimeout; | |
window.activeTimers=[]; | |
window.setTimeout=function(func,delay) | |
{ | |
var id = window.originalSetTimeout(func,delay); | |
window.activeTimers[id] = {"func": func, "delay": delay}; | |
return id; | |
}; | |
window.clearTimeout=function(timerID) | |
{ | |
delete window.activeTimers[timerID]; | |
window.originalClearTimeout(timerID); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment