Skip to content

Instantly share code, notes, and snippets.

@ndesmic
Last active October 20, 2016 19:25
Show Gist options
  • Save ndesmic/99ba43ac2f47e4b42e30f20e98350586 to your computer and use it in GitHub Desktop.
Save ndesmic/99ba43ac2f47e4b42e30f20e98350586 to your computer and use it in GitHub Desktop.
DevTool Snippets
console.log("Event Apocalypse!");
var elements = Array.prototype.slice.call(document.querySelectorAll("*"));
elements.unshift(document);
var count = 0;
var elCount = 0;
elements.forEach(x => {
elCount++;
let events = getEventListeners(x);
for(let key in events){
let eventArray = events[key];
eventArray.forEach(y => {
y.remove();
count++;
});
}
});
console.log(`${count} events cleared from ${elCount} elements`);
window.setTimeout = function(){
console.log("Timer set");
};
window.setInterval = function(){
console.log("Interval set");
}
"Timers are gone!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment