Skip to content

Instantly share code, notes, and snippets.

@Trion129
Created July 13, 2018 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Trion129/f7562809bb037ad4a9bc68d17943d663 to your computer and use it in GitHub Desktop.
Save Trion129/f7562809bb037ad4a9bc68d17943d663 to your computer and use it in GitHub Desktop.
Kills all timers in a website, doesn't kill already killed timeouts for micro optimisation for nerds :P
// Break Timers on websites with ease.
function timerKiller(){
var lastCleanedBorder = 0;
return function () {
var id = window.setTimeout(function() {}, 0);
for(var i = lastCleanedBorder; i <= id; i++) {
window.clearTimeout(i);
}
lastCleanedBorder = id + 1;
console.log(lastCleanedBorder);
}
}
@Trion129
Copy link
Author

Usage:

var state = timerKiller()
state()
state()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment