Skip to content

Instantly share code, notes, and snippets.

@Bamieh
Created October 19, 2016 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bamieh/86b144cdf5e64e73f84849fe3b150d05 to your computer and use it in GitHub Desktop.
Save Bamieh/86b144cdf5e64e73f84849fe3b150d05 to your computer and use it in GitHub Desktop.
Tiny Crossbrowser Keycode checking function
/*
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