aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar/utils/KeyCodes.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-04-03 11:45:15 -0400
committerbob <bcz@cs.brown.edu>2019-04-03 11:45:15 -0400
commitbb7d5a26ec68f283c5adb42d4d6554253de7176f (patch)
tree7efa817102ba54e916601611f608dd4bd761a437 /src/client/northstar/utils/KeyCodes.ts
parent43a0768690caa89c606dd5d296d3cc8825c1702b (diff)
parentc406c8d123ce0aa9d63fb8a4dd90adfe83d2889d (diff)
merged with master
Diffstat (limited to 'src/client/northstar/utils/KeyCodes.ts')
-rw-r--r--src/client/northstar/utils/KeyCodes.ts137
1 files changed, 137 insertions, 0 deletions
diff --git a/src/client/northstar/utils/KeyCodes.ts b/src/client/northstar/utils/KeyCodes.ts
new file mode 100644
index 000000000..044569ffe
--- /dev/null
+++ b/src/client/northstar/utils/KeyCodes.ts
@@ -0,0 +1,137 @@
+/**
+ * Class contains the keycodes for keys on your keyboard.
+ *
+ * Useful for auto completion:
+ *
+ * ```
+ * switch (event.key)
+ * {
+ * case KeyCode.UP:
+ * {
+ * // Up key pressed
+ * break;
+ * }
+ * case KeyCode.DOWN:
+ * {
+ * // Down key pressed
+ * break;
+ * }
+ * case KeyCode.LEFT:
+ * {
+ * // Left key pressed
+ * break;
+ * }
+ * case KeyCode.RIGHT:
+ * {
+ * // Right key pressed
+ * break;
+ * }
+ * default:
+ * {
+ * // ignore
+ * break;
+ * }
+ * }
+ * ```
+ */
+export class KeyCodes
+{
+ public static TAB:number = 9;
+ public static CAPS_LOCK:number = 20;
+ public static SHIFT:number = 16;
+ public static CONTROL:number = 17;
+ public static SPACE:number = 32;
+ public static DOWN:number = 40;
+ public static UP:number = 38;
+ public static LEFT:number = 37;
+ public static RIGHT:number = 39;
+ public static ESCAPE:number = 27;
+ public static F1:number = 112;
+ public static F2:number = 113;
+ public static F3:number = 114;
+ public static F4:number = 115;
+ public static F5:number = 116;
+ public static F6:number = 117;
+ public static F7:number = 118;
+ public static F8:number = 119;
+ public static F9:number = 120;
+ public static F10:number = 121;
+ public static F11:number = 122;
+ public static F12:number = 123;
+ public static INSERT:number = 45;
+ public static HOME:number = 36;
+ public static PAGE_UP:number = 33;
+ public static PAGE_DOWN:number = 34;
+ public static DELETE:number = 46;
+ public static END:number = 35;
+ public static ENTER:number = 13;
+ public static BACKSPACE:number = 8;
+ public static NUMPAD_0:number = 96;
+ public static NUMPAD_1:number = 97;
+ public static NUMPAD_2:number = 98;
+ public static NUMPAD_3:number = 99;
+ public static NUMPAD_4:number = 100;
+ public static NUMPAD_5:number = 101;
+ public static NUMPAD_6:number = 102;
+ public static NUMPAD_7:number = 103;
+ public static NUMPAD_8:number = 104;
+ public static NUMPAD_9:number = 105;
+ public static NUMPAD_DIVIDE:number = 111;
+ public static NUMPAD_ADD:number = 107;
+ public static NUMPAD_ENTER:number = 13;
+ public static NUMPAD_DECIMAL:number = 110;
+ public static NUMPAD_SUBTRACT:number = 109;
+ public static NUMPAD_MULTIPLY:number = 106;
+ public static SEMICOLON:number = 186;
+ public static EQUAL:number = 187;
+ public static COMMA:number = 188;
+ public static MINUS:number = 189;
+ public static PERIOD:number = 190;
+ public static SLASH:number = 191;
+ public static BACKQUOTE:number = 192;
+ public static LEFTBRACKET:number = 219;
+ public static BACKSLASH:number = 220;
+ public static RIGHTBRACKET:number = 221;
+ public static QUOTE:number = 222;
+ public static ALT:number = 18;
+ public static COMMAND:number = 15;
+ public static NUMPAD:number = 21;
+ public static A:number = 65;
+ public static B:number = 66;
+ public static C:number = 67;
+ public static D:number = 68;
+ public static E:number = 69;
+ public static F:number = 70;
+ public static G:number = 71;
+ public static H:number = 72;
+ public static I:number = 73;
+ public static J:number = 74;
+ public static K:number = 75;
+ public static L:number = 76;
+ public static M:number = 77;
+ public static N:number = 78;
+ public static O:number = 79;
+ public static P:number = 80;
+ public static Q:number = 81;
+ public static R:number = 82;
+ public static S:number = 83;
+ public static T:number = 84;
+ public static U:number = 85;
+ public static V:number = 86;
+ public static W:number = 87;
+ public static X:number = 88;
+ public static Y:number = 89;
+ public static Z:number = 90;
+ public static NUM_0:number = 48;
+ public static NUM_1:number = 49;
+ public static NUM_2:number = 50;
+ public static NUM_3:number = 51;
+ public static NUM_4:number = 52;
+ public static NUM_5:number = 53;
+ public static NUM_6:number = 54;
+ public static NUM_7:number = 55;
+ public static NUM_8:number = 56;
+ public static NUM_9:number = 57;
+ public static SUBSTRACT:number = 189;
+ public static ADD:number = 187;
+} \ No newline at end of file