Use the members of the newly added KeyActionType object because static members were uninitialized. Handle PlayMacroAction in the KeyActionFactory.

This commit is contained in:
László Monda
2016-04-01 03:43:34 +02:00
parent fcd0d5b5b3
commit 1697d673f2
10 changed files with 45 additions and 41 deletions

View File

@@ -13,7 +13,6 @@ enum LongPressAction {
}
class DualRoleKeystrokeAction extends KeyAction implements Serializable<DualRoleKeystrokeAction> {
static keyActionTypeString = 'dualRoleKeystroke';
public scancode;
@@ -24,18 +23,18 @@ class DualRoleKeystrokeAction extends KeyAction implements Serializable<DualRole
}
set longPressAction(value) {
if (!DualRoleKeystrokeAction.isDualRoleKeystrokeActionValid(value)) {
if (!this.isDualRoleKeystrokeActionValid(value)) {
throw `Invalid DualRoleKeystrokeAction.longPressAction: ${value}`;
}
this._longPressAction = value;
}
static isDualRoleKeystrokeActionValid(keyActionIdParam): boolean {
return MouseActionParam[keyActionIdParam] !== undefined;
isDualRoleKeystrokeActionValid(keyActionIdParam): boolean {
return LongPressAction[keyActionIdParam] !== undefined;
}
fromJsObject(jsObject: any): DualRoleKeystrokeAction {
this.assertKeyActionType(jsObject, DualRoleKeystrokeAction.keyActionTypeString, 'DualRoleKeystrokeAction');
this.assertKeyActionType(jsObject, KeyActionType.DualRoleKeystrokeAction, 'DualRoleKeystrokeAction');
this.scancode = jsObject.scancode;
this.longPressAction = jsObject.longPressAction;
return this;
@@ -50,7 +49,7 @@ class DualRoleKeystrokeAction extends KeyAction implements Serializable<DualRole
toJsObject(): any {
return {
keyActionType: DualRoleKeystrokeAction.keyActionTypeString,
keyActionType: KeyActionType.DualRoleKeystrokeAction,
scancode: this.scancode,
longPressAction: KeyActionId[this.longPressAction]
};