Skip to content

Instantly share code, notes, and snippets.

@willbarrett
Created November 19, 2014 18:21
Show Gist options
  • Save willbarrett/30ee2c0d83f7e1037d26 to your computer and use it in GitHub Desktop.
Save willbarrett/30ee2c0d83f7e1037d26 to your computer and use it in GitHub Desktop.
Track all intervals
window.originalSetInterval = window.setInterval;
window.activeIntervals = 0;
window.activeIntervalList = {};
window.setInterval = function(func, delay, identifier) {
var interval = window.originalSetInterval(func, delay);
window.activeIntervalList[interval] = {ident: identifier, func: func, delay: delay};
return interval;
};
window.originalClearInterval = window.clearInterval;
window.clearInterval = function(interval) {
delete(window.activeIntervalList[interval]);
window.originalClearInterval(interval);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment