AsyncMacroCommand.ts 758 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * 异步组合宏命令基类
  3. * 该组合宏中的子命令是同步执行的,会按照添加的顺序同步执行。
  4. */
  5. import MacroCommand from "./MacroCommand";
  6. export default abstract class AsyncMacroCommand extends MacroCommand {
  7. /**
  8. * 异步执行组合命令
  9. */
  10. private asyncExecute(): void {
  11. let cmdList = this["_commandList"];
  12. for (let cmd of cmdList) {
  13. let tempCmd = new cmd.cmd();
  14. tempCmd.execute(cmd.body);
  15. }
  16. }
  17. /**
  18. * 异步撤销组合命令
  19. */
  20. private asyncUndo(): void {
  21. let cmdList = this["_commandList"];
  22. for (let cmd of cmdList) {
  23. let tempCmd = new cmd.cmd();
  24. tempCmd.undo(cmd.body);
  25. }
  26. }
  27. }