Created
September 30, 2016 14:24
-
-
Save bdelespierre/f593e9630f4c5e1595e04317356d6e26 to your computer and use it in GitHub Desktop.
just for fun
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
(function(w) { | |
var konami = [38,38,40,40,37,39,37,39,66,65], n = -1; | |
w.addEventListener('keyup', function(event){ | |
(n = event.keyCode == konami[n+1] ? n+1 : -1) == konami.length-1 && w.dispatchEvent(new Event('konami')); | |
}); | |
w.konami = function(callback) { | |
w.addEventListener('konami', callback); | |
} | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment