Created
October 19, 2016 06:47
-
-
Save Bamieh/86b144cdf5e64e73f84849fe3b150d05 to your computer and use it in GitHub Desktop.
Tiny Crossbrowser Keycode checking function
This file contains hidden or 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
/* | |
usage: | |
Events.on(window, 'keydown', (event) => { | |
tabPressed = keycode(event, 13); | |
}); | |
*/ | |
export default function keycode(event, code) { | |
const property = event.key || event.keyIdentifier || event.keyCode; | |
return property && property === code; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment