Make Serializable dump fromJsObject() calls.

This commit is contained in:
László Monda
2016-04-02 00:58:06 +02:00
parent 2dca5c1c14
commit 7841779b46
11 changed files with 121 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapAction> {
class SwitchKeymapAction extends KeyAction {
private _keymapId: number;
@@ -13,27 +13,31 @@ class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapA
this._keymapId = value;
}
fromJsObject(jsObject: any): SwitchKeymapAction {
_fromJsObject(jsObject: any): SwitchKeymapAction {
this.assertKeyActionType(jsObject, KeyActionType.SwitchKeymapAction, 'SwitchKeymapAction');
this.keymapId = jsObject.keymapId;
return this;
}
fromBinary(buffer: UhkBuffer): SwitchKeymapAction {
_fromBinary(buffer: UhkBuffer): SwitchKeymapAction {
this.readAndAssertKeyActionId(buffer, KeyActionId.SwitchKeymapAction, 'SwitchKeymapAction');
this.keymapId = buffer.readUInt8();
return this;
}
toJsObject(): any {
_toJsObject(): any {
return {
keyActionType: KeyActionType.SwitchKeymapAction,
keymapId: this.keymapId
};
}
toBinary(buffer: UhkBuffer) {
_toBinary(buffer: UhkBuffer) {
buffer.writeUInt8(KeyActionId.SwitchKeymapAction);
buffer.writeUInt8(this.keymapId);
}
toString(): string {
return `<SwitchKeymapAction keymapId="${this.keymapId}">`;
}
}