Skip to content

Commit

Permalink
fix: AbstractCommand works with static MaskFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
Balte de Wit committed Jun 9, 2018
1 parent 5c82037 commit 360f266
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/commands/AbstractCommand.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AtemState } from '../state'

export default abstract class AbstractCommand {
static MaskFlags?: { [key: string]: number }
abstract rawName: string
packetId: number
MaskFlags?: { [key: string]: number }
flag: number = 0

resolve: (cmd: AbstractCommand) => void
Expand All @@ -24,11 +24,12 @@ export default abstract class AbstractCommand {
...this.properties,
...newProps
}
const maskFlags = (this.constructor as any).MaskFlags as { [key: string]: number }

if (this.MaskFlags) {
if (maskFlags) {
for (const key in newProps) {
if (key in this.MaskFlags) {
this.flag = this.flag | this.MaskFlags[key]
if (key in maskFlags) {
this.flag = this.flag | maskFlags[key]
}
}
}
Expand Down

0 comments on commit 360f266

Please sign in to comment.