blob: 05b51d3800e30047ccd5f4a67376d2946dac314e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { Command } from "./base-command";
export class BatchCommand extends Command {
constructor(private commands: Command[]) {
super();
}
execute(): void {
for (const command of this.commands) {
command.execute();
}
}
undo(): void {
for (const command of [...this.commands].reverse()) {
command.undo();
}
}
redo(): void {
for (const command of this.commands) {
command.execute();
}
}
}
|