Last active
October 20, 2016 19:25
-
-
Save ndesmic/99ba43ac2f47e4b42e30f20e98350586 to your computer and use it in GitHub Desktop.
DevTool Snippets
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
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`); |
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
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