Files
agent/shared/src/config-serializer/config-items/key-action/NoneAction.ts
2017-02-05 20:31:52 +01:00

36 lines
806 B
TypeScript

import { UhkBuffer } from '../../UhkBuffer';
import { KeyAction, KeyActionId, keyActionType } from './KeyAction';
/**
* NoneAction is only intended for binary serialization of undefined key actions
* DO NOT use it as a real KeyAction
*
*/
export class NoneAction extends KeyAction {
fromJsonObject(jsonObject: any): NoneAction {
this.assertKeyActionType(jsonObject);
return this;
}
fromBinary(buffer: UhkBuffer): NoneAction {
this.readAndAssertKeyActionId(buffer);
return this;
}
toJsonObject(): any {
return {
keyActionType: keyActionType.NoneAction
};
}
toBinary(buffer: UhkBuffer) {
buffer.writeUInt8(KeyActionId.NoneAction);
}
toString(): string {
return '<NoneAction>';
}
}