mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
26 lines
423 B
TypeScript
26 lines
423 B
TypeScript
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();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|