14 lines
406 B
TypeScript
14 lines
406 B
TypeScript
import { CommandReceiver } from './command-receiver';
|
|
import { Command } from './command';
|
|
|
|
export class CommandGenerator {
|
|
private subscribers: Array<CommandReceiver> = [];
|
|
|
|
public subscribe(subscriber: CommandReceiver): void {
|
|
this.subscribers.push(subscriber);
|
|
}
|
|
|
|
protected sendCommandToSubcribers(command: Command): void {
|
|
this.subscribers.forEach((s) => s.sendCommand(command));
|
|
}
|
|
}
|