changing how assertions access instance variables to make them non-static-like (#37)
Changing how assertions access instance variables
This commit is contained in:
@@ -1,68 +1,78 @@
|
|||||||
function assertUInt8(target: any, key: string) {
|
export function assertUInt8(target: any, key: string) {
|
||||||
return assertInteger(target, key, 0, 0xFF);
|
return assertInteger(target, key, 0, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertInt8(target: any, key: string) {
|
export function assertInt8(target: any, key: string) {
|
||||||
return assertInteger(target, key, -0x80, 0x7F);
|
return assertInteger(target, key, -0x80, 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertUInt16(target: any, key: string) {
|
export function assertUInt16(target: any, key: string) {
|
||||||
return assertInteger(target, key, 0, 0xFFFF);
|
return assertInteger(target, key, 0, 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertInt16(target: any, key: string) {
|
export function assertInt16(target: any, key: string) {
|
||||||
return assertInteger(target, key, -0x8000, 0x7FFF);
|
return assertInteger(target, key, -0x8000, 0x7FFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertUInt32(target: any, key: string) {
|
export function assertUInt32(target: any, key: string) {
|
||||||
return assertInteger(target, key, 0, 0xFFFFFFFF);
|
return assertInteger(target, key, 0, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertInt32(target: any, key: string) {
|
export function assertInt32(target: any, key: string) {
|
||||||
return assertInteger(target, key, -0x80000000, 0x7FFFFFFF);
|
return assertInteger(target, key, -0x80000000, 0x7FFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertCompactLength(target: any, key: string) {
|
export function assertCompactLength(target: any, key: string) {
|
||||||
return assertUInt16(target, key);
|
return assertUInt16(target, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertInteger(target: any, key: string, min: number, max: number) {
|
function assertInteger(target: any, key: string, min: number, max: number) {
|
||||||
let val = this[key];
|
const priv = '_' + key;
|
||||||
if (delete this[key]) {
|
|
||||||
Object.defineProperty(target, key, {
|
function getter() {
|
||||||
get: function () {
|
return this[priv];
|
||||||
return val;
|
}
|
||||||
},
|
|
||||||
set: function (newVal) {
|
function setter(newVal: any) {
|
||||||
if (newVal < min || newVal > max) {
|
if (this[priv] !== newVal) {
|
||||||
throw `${target.constructor.name}.${key}: ` +
|
if (newVal < min || newVal > max) {
|
||||||
`Integer ${newVal} is outside the valid [${min}, ${max}] interval`;
|
throw `${target.constructor.name}.${key}: ` +
|
||||||
|
`Integer ${newVal} is outside the valid [${min}, ${max}] interval`;
|
||||||
|
}
|
||||||
|
this[priv] = newVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(target, key, {
|
||||||
|
get: getter,
|
||||||
|
set: setter,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function assertEnum<E>(enumerated: E) {
|
||||||
|
return function(target: any, key: string) {
|
||||||
|
const priv = '_' + key;
|
||||||
|
|
||||||
|
function getter() {
|
||||||
|
return this[priv];
|
||||||
|
}
|
||||||
|
|
||||||
|
function setter(newVal: any) {
|
||||||
|
if (this[priv] !== newVal) {
|
||||||
|
if (enumerated[newVal] === undefined) {
|
||||||
|
throw `${target.constructor.name}.${key}: ${newVal} is not enum`;
|
||||||
}
|
}
|
||||||
val = newVal;
|
this[priv] = newVal;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(target, key, {
|
||||||
|
get: getter,
|
||||||
|
set: setter,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function assertEnum<E>(enumerated: E) {
|
|
||||||
return function(target: any, key: string) {
|
|
||||||
let val = this[key];
|
|
||||||
if (delete this[key]) {
|
|
||||||
Object.defineProperty(target, key, {
|
|
||||||
get: function () {
|
|
||||||
return val;
|
|
||||||
},
|
|
||||||
set: function (newVal) {
|
|
||||||
if (enumerated[newVal] === undefined) {
|
|
||||||
throw `${target.constructor.name}.${key}: ${newVal} is not enum`;
|
|
||||||
}
|
|
||||||
val = newVal;
|
|
||||||
},
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {MacroAction, macroActionType, MacroActionId} from './MacroAction';
|
import {MacroAction, macroActionType, MacroActionId} from './MacroAction';
|
||||||
|
import {assertUInt16} from '../assert';
|
||||||
|
|
||||||
export class DelayMacroAction extends MacroAction {
|
export class DelayMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt16
|
@assertUInt16
|
||||||
delay: number;
|
delay: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): DelayMacroAction {
|
_fromJsObject(jsObject: any): DelayMacroAction {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
|
import {assertUInt8, assertEnum} from '../assert';
|
||||||
|
|
||||||
enum LongPressAction {
|
enum LongPressAction {
|
||||||
leftCtrl,
|
leftCtrl,
|
||||||
@@ -17,10 +18,10 @@ enum LongPressAction {
|
|||||||
|
|
||||||
export class DualRoleKeystrokeAction extends KeyAction {
|
export class DualRoleKeystrokeAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
scancode: number;
|
scancode: number;
|
||||||
|
|
||||||
// @assertEnum(LongPressAction)
|
@assertEnum(LongPressAction)
|
||||||
private longPressAction: LongPressAction;
|
private longPressAction: LongPressAction;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): DualRoleKeystrokeAction {
|
_fromJsObject(jsObject: any): DualRoleKeystrokeAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class HoldKeyMacroAction extends MacroAction {
|
export class HoldKeyMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
scancode: number;
|
scancode: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): HoldKeyMacroAction {
|
_fromJsObject(jsObject: any): HoldKeyMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class HoldModifiersMacroAction extends MacroAction {
|
export class HoldModifiersMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
modifierMask: number;
|
modifierMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): HoldModifiersMacroAction {
|
_fromJsObject(jsObject: any): HoldModifiersMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class HoldMouseButtonsMacroAction extends MacroAction {
|
export class HoldMouseButtonsMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
mouseButtonsMask: number;
|
mouseButtonsMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): HoldMouseButtonsMacroAction {
|
_fromJsObject(jsObject: any): HoldMouseButtonsMacroAction {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import {Serializable} from '../Serializable';
|
import {Serializable} from '../Serializable';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {Layers} from './Layers';
|
import {Layers} from './Layers';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class KeyMap extends Serializable<KeyMap> {
|
export class KeyMap extends Serializable<KeyMap> {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class KeystrokeAction extends KeyAction {
|
export class KeystrokeAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
scancode: number;
|
scancode: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): KeystrokeAction {
|
_fromJsObject(jsObject: any): KeystrokeAction {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export enum KeyModifiers {
|
export enum KeyModifiers {
|
||||||
leftCtrl = 1 << 0,
|
leftCtrl = 1 << 0,
|
||||||
@@ -14,7 +15,7 @@ export enum KeyModifiers {
|
|||||||
|
|
||||||
export class KeystrokeModifiersAction extends KeyAction {
|
export class KeystrokeModifiersAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
modifierMask: number;
|
modifierMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): KeystrokeModifiersAction {
|
_fromJsObject(jsObject: any): KeystrokeModifiersAction {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
import {KeyModifiers} from './KeystrokeModifiersAction';
|
import {KeyModifiers} from './KeystrokeModifiersAction';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class KeystrokeWithModifiersAction extends KeyAction {
|
export class KeystrokeWithModifiersAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
modifierMask: number;
|
modifierMask: number;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
scancode: number;
|
scancode: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): KeystrokeWithModifiersAction {
|
_fromJsObject(jsObject: any): KeystrokeWithModifiersAction {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import {Serializable} from '../Serializable';
|
import {Serializable} from '../Serializable';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {MacroActions} from './MacroActions';
|
import {MacroActions} from './MacroActions';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class Macro extends Serializable<Macro> {
|
export class Macro extends Serializable<Macro> {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
isLooped: boolean;
|
isLooped: boolean;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {Serializable} from '../Serializable';
|
import {Serializable} from '../Serializable';
|
||||||
import {KeyActions} from './KeyActions';
|
import {KeyActions} from './KeyActions';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8, assertEnum} from '../assert';
|
||||||
|
|
||||||
enum PointerRole {
|
enum PointerRole {
|
||||||
none,
|
none,
|
||||||
@@ -10,12 +11,12 @@ enum PointerRole {
|
|||||||
|
|
||||||
export class Module extends Serializable<Module> {
|
export class Module extends Serializable<Module> {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
keyActions: KeyActions;
|
keyActions: KeyActions;
|
||||||
|
|
||||||
// @assertEnum(PointerRole)
|
@assertEnum(PointerRole)
|
||||||
private pointerRole: PointerRole;
|
private pointerRole: PointerRole;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): Module {
|
_fromJsObject(jsObject: any): Module {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {Serializable} from '../Serializable';
|
import {Serializable} from '../Serializable';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class ModuleConfiguration extends Serializable<ModuleConfiguration> {
|
export class ModuleConfiguration extends Serializable<ModuleConfiguration> {
|
||||||
|
|
||||||
@@ -7,16 +8,16 @@ export class ModuleConfiguration extends Serializable<ModuleConfiguration> {
|
|||||||
* module id enumeration is a separate story
|
* module id enumeration is a separate story
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
initialPointerSpeed: number;
|
initialPointerSpeed: number;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
pointerAcceleration: number;
|
pointerAcceleration: number;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
maxPointerSpeed: number;
|
maxPointerSpeed: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): ModuleConfiguration {
|
_fromJsObject(jsObject: any): ModuleConfiguration {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertEnum} from '../assert';
|
||||||
|
|
||||||
enum MouseActionParam {
|
enum MouseActionParam {
|
||||||
leftClick,
|
leftClick,
|
||||||
@@ -19,7 +20,7 @@ enum MouseActionParam {
|
|||||||
|
|
||||||
export class MouseAction extends KeyAction {
|
export class MouseAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertEnum(MouseActionParam)
|
||||||
mouseAction: MouseActionParam;
|
mouseAction: MouseActionParam;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): MouseAction {
|
_fromJsObject(jsObject: any): MouseAction {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import {MacroAction, macroActionType, MacroActionId} from './MacroAction';
|
import {MacroAction, macroActionType, MacroActionId} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertInt16} from '../assert';
|
||||||
|
|
||||||
export class MoveMouseMacroAction extends MacroAction {
|
export class MoveMouseMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertInt16
|
@assertInt16
|
||||||
x: number;
|
x: number;
|
||||||
|
|
||||||
// @assertInt16
|
@assertInt16
|
||||||
y: number;
|
y: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): MoveMouseMacroAction {
|
_fromJsObject(jsObject: any): MoveMouseMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class PlayMacroAction extends KeyAction {
|
export class PlayMacroAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
macroId: number;
|
macroId: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): PlayMacroAction {
|
_fromJsObject(jsObject: any): PlayMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class PressKeyMacroAction extends MacroAction {
|
export class PressKeyMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
scancode: number;
|
scancode: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): PressKeyMacroAction {
|
_fromJsObject(jsObject: any): PressKeyMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class PressModifiersMacroAction extends MacroAction {
|
export class PressModifiersMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
modifierMask: number;
|
modifierMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): PressModifiersMacroAction {
|
_fromJsObject(jsObject: any): PressModifiersMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class PressMouseButtonsMacroAction extends MacroAction {
|
export class PressMouseButtonsMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
mouseButtonsMask: number;
|
mouseButtonsMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): PressMouseButtonsMacroAction {
|
_fromJsObject(jsObject: any): PressMouseButtonsMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class ReleaseKeyMacroAction extends MacroAction {
|
export class ReleaseKeyMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
scancode: number;
|
scancode: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): ReleaseKeyMacroAction {
|
_fromJsObject(jsObject: any): ReleaseKeyMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class ReleaseModifiersMacroAction extends MacroAction {
|
export class ReleaseModifiersMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
modifierMask: number;
|
modifierMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): ReleaseModifiersMacroAction {
|
_fromJsObject(jsObject: any): ReleaseModifiersMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class ReleaseMouseButtonsMacroAction extends MacroAction {
|
export class ReleaseMouseButtonsMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
mouseButtonsMask: number;
|
mouseButtonsMask: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): ReleaseMouseButtonsMacroAction {
|
_fromJsObject(jsObject: any): ReleaseMouseButtonsMacroAction {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
import {MacroAction, MacroActionId, macroActionType} from './MacroAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertInt16} from '../assert';
|
||||||
|
|
||||||
export class ScrollMouseMacroAction extends MacroAction {
|
export class ScrollMouseMacroAction extends MacroAction {
|
||||||
|
|
||||||
// @assertInt16
|
@assertInt16
|
||||||
x: number;
|
x: number;
|
||||||
|
|
||||||
// @assertInt16
|
@assertInt16
|
||||||
y: number;
|
y: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): ScrollMouseMacroAction {
|
_fromJsObject(jsObject: any): ScrollMouseMacroAction {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class SwitchKeymapAction extends KeyAction {
|
export class SwitchKeymapAction extends KeyAction {
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
keymapId: number;
|
keymapId: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): SwitchKeymapAction {
|
_fromJsObject(jsObject: any): SwitchKeymapAction {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertEnum} from '../assert';
|
||||||
|
|
||||||
export enum LayerName {
|
export enum LayerName {
|
||||||
mod,
|
mod,
|
||||||
@@ -11,7 +12,7 @@ export class SwitchLayerAction extends KeyAction {
|
|||||||
|
|
||||||
isLayerToggleable: boolean;
|
isLayerToggleable: boolean;
|
||||||
|
|
||||||
// @assertEnum(LayerName)
|
@assertEnum(LayerName)
|
||||||
private _layer: LayerName;
|
private _layer: LayerName;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): SwitchLayerAction {
|
_fromJsObject(jsObject: any): SwitchLayerAction {
|
||||||
|
|||||||
@@ -3,21 +3,22 @@ import {ModuleConfigurations} from './ModuleConfigurations';
|
|||||||
import {KeyMaps} from './KeyMaps';
|
import {KeyMaps} from './KeyMaps';
|
||||||
import {Macros} from './Macros';
|
import {Macros} from './Macros';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
|
import {assertUInt8, assertUInt32} from '../assert';
|
||||||
|
|
||||||
export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
||||||
|
|
||||||
signature: string;
|
signature: string;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
dataModelVersion: number;
|
dataModelVersion: number;
|
||||||
|
|
||||||
// @assertUInt32
|
@assertUInt32
|
||||||
prologue: number;
|
prologue: number;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
hardwareId: number;
|
hardwareId: number;
|
||||||
|
|
||||||
// @assertUInt8
|
@assertUInt8
|
||||||
brandId: number;
|
brandId: number;
|
||||||
|
|
||||||
moduleConfigurations: ModuleConfigurations;
|
moduleConfigurations: ModuleConfigurations;
|
||||||
@@ -26,7 +27,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
|
|
||||||
macros: Macros;
|
macros: Macros;
|
||||||
|
|
||||||
// @assertUInt32
|
@assertUInt32
|
||||||
epilogue: number;
|
epilogue: number;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): UhkConfiguration {
|
_fromJsObject(jsObject: any): UhkConfiguration {
|
||||||
|
|||||||
Reference in New Issue
Block a user