Skip to content

Instantly share code, notes, and snippets.

@Xanir Xanir/Keyboard Command Key
Last active Jul 13, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.