Files
agent/config-serializer/config-items/TextMacroAction.ts
2016-04-17 23:34:21 -05:00

33 lines
775 B
TypeScript

class TextMacroAction extends MacroAction {
text: string;
_fromJsObject(jsObject: any): TextMacroAction {
this.assertMacroActionType(jsObject);
this.text = jsObject.text;
return this;
}
_fromBinary(buffer: UhkBuffer): TextMacroAction {
this.readAndAssertMacroActionId(buffer);
this.text = buffer.readString();
return this;
}
_toJsObject(): any {
return {
macroActionType: macroActionType.TextMacroAction,
text: this.text
};
}
_toBinary(buffer: UhkBuffer) {
buffer.writeUInt8(MacroActionId.TextMacroAction);
buffer.writeString(this.text);
}
toString(): string {
return `<TextMacroAction text="${this.text}">`;
}
}