Use template strings where needed.
This commit is contained in:
@@ -25,7 +25,7 @@ class DualRoleKeystrokeAction extends KeyAction implements Serializable<DualRole
|
||||
|
||||
set longPressAction(value) {
|
||||
if (!DualRoleKeystrokeAction.isDualRoleKeystrokeActionValid(value)) {
|
||||
throw 'Invalid DualRoleKeystrokeAction.longPressAction: ${value}';
|
||||
throw `Invalid DualRoleKeystrokeAction.longPressAction: ${value}`;
|
||||
}
|
||||
this._longPressAction = value;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class KeyAction {
|
||||
case NoneAction.keyActionTypeString:
|
||||
return new NoneAction().fromJsObject(jsObject);
|
||||
default:
|
||||
throw 'Invalid KeyAction.keyActionType: "${jsObject.actionType}"';
|
||||
throw `Invalid KeyAction.keyActionType: "${jsObject.actionType}"`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,20 +39,20 @@ class KeyAction {
|
||||
case KeyActionId.NoneAction:
|
||||
return new NoneAction().fromBinary(buffer);
|
||||
default:
|
||||
throw 'Invalid KeyAction first byte "${keyActionFirstByte}"';
|
||||
throw `Invalid KeyAction first byte "${keyActionFirstByte}"`;
|
||||
}
|
||||
}
|
||||
|
||||
assertKeyActionType(jsObject: any, keyActionTypeString: string, classname: string) {
|
||||
if (jsObject.keyActionType !== keyActionTypeString) {
|
||||
throw 'Invalid ${classname}.id: ${jsObject.keyActionType}';
|
||||
throw `Invalid ${classname}.keyActionType: ${jsObject.keyActionType}`;
|
||||
}
|
||||
}
|
||||
|
||||
readAndAssertKeyActionId(buffer: UhkBuffer, keyActionIdParam: KeyActionId, classname: string) {
|
||||
let readKeyActionId = buffer.readUInt8();
|
||||
if (readKeyActionId !== keyActionIdParam) {
|
||||
throw 'Invalid ${classname} first byte: ${keyActionId}';
|
||||
throw `Invalid ${classname} first byte: ${readKeyActionId}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class KeystrokeAction extends KeyAction implements Serializable<KeystrokeAction>
|
||||
|
||||
set scancode(value) {
|
||||
if (!TypeChecker.isScancodeValid(value)) {
|
||||
throw 'Invalid KeystrokeAction.scancode: ${scancode}';
|
||||
throw `Invalid KeystrokeAction.scancode: ${value}`;
|
||||
}
|
||||
this._scancode = value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class KeystrokeWithModifiersAction extends KeyAction implements Serializable<Key
|
||||
|
||||
set scancode(value) {
|
||||
if (!TypeChecker.isScancodeValid(value)) {
|
||||
throw 'Invalid KeystrokeWithModifiersAction.scancode: ${scancode}';
|
||||
throw `Invalid KeystrokeWithModifiersAction.scancode: ${value}`;
|
||||
}
|
||||
this._scancode = value;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class MouseAction extends KeyAction implements Serializable<MouseAction> {
|
||||
|
||||
set mouseAction(mouseAction) {
|
||||
if (!MouseAction.isMouseActionValid(mouseAction)) {
|
||||
throw 'Invalid MouseAction.mouseAction: ${mouseAction}';
|
||||
throw `Invalid MouseAction.mouseAction: ${mouseAction}`;
|
||||
}
|
||||
this._mouseAction = mouseAction;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class MouseAction extends KeyAction implements Serializable<MouseAction> {
|
||||
|
||||
this.mouseAction = buffer.readUInt8();
|
||||
if (!MouseAction.isMouseActionValid(this.mouseAction)) {
|
||||
throw 'Invalid MouseAction.param: ${keyActionParam}';
|
||||
throw `Invalid MouseAction.param: ${this.mouseAction}`;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
@@ -13,7 +13,7 @@ class NoneAction extends KeyAction implements Serializable<NoneAction> {
|
||||
|
||||
let keyActionParam = buffer.readUInt8();
|
||||
if (keyActionParam !== NoneAction.noneActionParam) {
|
||||
throw 'Invalid NoneAction.param: ${keyActionParam}';
|
||||
throw `Invalid NoneAction.param: ${keyActionParam}`;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
@@ -10,7 +10,7 @@ class PlayMacroAction extends KeyAction implements Serializable<PlayMacroAction>
|
||||
|
||||
set macroId(value) {
|
||||
if (!TypeChecker.isUInt8Valid(value)) {
|
||||
throw 'Invalid PlayMacroAction.macroId: ${value}';
|
||||
throw `Invalid PlayMacroAction.macroId: ${value}`;
|
||||
}
|
||||
this._macroId = value;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapA
|
||||
|
||||
set keymapId(value) {
|
||||
if (!TypeChecker.isUInt8Valid(value)) {
|
||||
throw 'Invalid SwitchKeymapAction.keymapId: ${value}';
|
||||
throw `Invalid SwitchKeymapAction.keymapId: ${value}`;
|
||||
}
|
||||
this._keymapId = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user