From 924234cea837d98c271e68a5fa9a4ae3f0b9f02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 28 Mar 2016 23:59:09 +0200 Subject: [PATCH] Extract key action types to their respective classes. --- model/KeyAction.ts | 4 ++-- model/KeyActionNone.ts | 1 + model/KeystrokeAction.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/model/KeyAction.ts b/model/KeyAction.ts index 9ccc4edc..0634546e 100644 --- a/model/KeyAction.ts +++ b/model/KeyAction.ts @@ -5,11 +5,11 @@ class KeyAction { static fromJsObject(jsObject: any): KeyAction { switch (jsObject.keyActionType) { - case 'none': + case KeystrokeAction.actionTypeString: let keyActionNone = new KeyActionNone(); keyActionNone.fromJsObject(jsObject); return keyActionNone; - case 'keyStroke': + case KeystrokeAction.actionTypeString: let keystrokeAction = new KeystrokeAction(); keystrokeAction.fromJsObject(jsObject); return keystrokeAction; diff --git a/model/KeyActionNone.ts b/model/KeyActionNone.ts index b483da67..78a55625 100644 --- a/model/KeyActionNone.ts +++ b/model/KeyActionNone.ts @@ -2,6 +2,7 @@ /// class KeyActionNone extends KeyAction implements Serializable { + static actionTypeString = 'none'; static keyActionNoneId = 0; static keyActionNoneParam = 0; diff --git a/model/KeystrokeAction.ts b/model/KeystrokeAction.ts index 727552f1..b34d53e9 100644 --- a/model/KeystrokeAction.ts +++ b/model/KeystrokeAction.ts @@ -3,6 +3,7 @@ class KeystrokeAction extends KeyAction implements Serializable { + static actionTypeString = 'keyStroke'; static firstValidScancode = 1; static lastValidScancode = 231;