Make KeyAction.assertKeyActiontype() and KeyAction.readAndAssertKeyActionId() only expect a single argument.

This commit is contained in:
László Monda
2016-04-09 00:39:17 +02:00
parent a3b83dfb36
commit 34ff0d657d
11 changed files with 27 additions and 26 deletions

View File

@@ -18,14 +18,14 @@ class SwitchLayerAction extends KeyAction {
}
_fromJsObject(jsObject: any): SwitchLayerAction {
this.assertKeyActionType(jsObject, keyActionType.SwitchLayerAction, 'SwitchLayerAction');
this.assertKeyActionType(jsObject);
this.layer = Layer[<string> jsObject.layer];
this.isLayerToggleable = jsObject.toggle;
return this;
}
_fromBinary(buffer: UhkBuffer): SwitchLayerAction {
this.readAndAssertKeyActionId(buffer, KeyActionId.SwitchLayerAction, 'SwitchLayerAction');
this.readAndAssertKeyActionId(buffer);
let layer = buffer.readUInt8();
this.isLayerToggleable = (layer & SwitchLayerAction.toggleFlag) !== 0;
layer &= ~SwitchLayerAction.toggleFlag; // Clear toggle bit.