Last active
January 4, 2021 09:01
-
-
Save nikopol/1121a9add75cc6fc20cf6ce1848e767b to your computer and use it in GitHub Desktop.
happy new year!
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
(() => { | |
let p = 0; | |
const | |
ucb = p => new Promise(r => r(alert('happy new year!'))), | |
l = () => document.addEventListener('keydown', el), | |
cb = () => ucb(document.removeEventListener('keydown', el)).then(l), | |
k = [76,82,85,68,97,98], | |
co = [2,2,3,3,0,1,0,1,5,4], | |
el = e => { | |
p = k[co[p]] - e.key.charCodeAt(Math.min(e.key.length-1, 5)) ? 0 : ++p===10 ? cb()||0 : p; | |
return true; | |
}; | |
l(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment