Last active
August 29, 2015 14:17
-
-
Save jason-s13r/0199179c7f57ea7a379a to your computer and use it in GitHub Desktop.
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
konami(function(){ | |
console.log('KONAMI!!!'); | |
}); | |
function konami(fn, match) { | |
var konamiCode = '3838404037393739666513'; | |
var sequence = ''; | |
match = match || konamiCode; | |
window.addEventListener('keyup', function(event){ | |
sequence += event.keyCode; | |
if (match === sequence) { | |
fn(); | |
} | |
if (match.indexOf(sequence) === -1) { | |
sequence = ''; | |
} | |
}, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment