Skip to content

Instantly share code, notes, and snippets.

@Xanir
Last active July 13, 2016 23:16
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 Xanir/d42994ba5c564f86d9831a409a4b6272 to your computer and use it in GitHub Desktop.
Save Xanir/d42994ba5c564f86d9831a409a4b6272 to your computer and use it in GitHub Desktop.
var isCommandKey = function (keycode) {
if (keycode < 47) {
// Most Command Keys
return true;
} else if (keycode === 91 || keycode === 92 || keycode === 93) {
// Windows keys
return true;
} else if (keycode === 144 || keycode === 145) {
// Scroll Lock / Num Lock
return true;
} else if (keycode >= 112 && keycode <= 123) {
// F keys
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment