()
| 537 | // we don't mess with [0] because it is "in process" |
| 538 | // we replace [1] because there is no point to run an action that is going to be overwritten |
| 539 | private async processActionQueue() { |
| 540 | while (this.actionQueue.length > 0) { |
| 541 | try { |
| 542 | if (this.isDestroyed()) { |
| 543 | break; |
| 544 | } |
| 545 | const entry = this.actionQueue[0]; |
| 546 | let tabId: string = null; |
| 547 | // have to use "===" here to get the typechecker to work :/ |
| 548 | switch (entry.op) { |
| 549 | case "createtab": |
| 550 | tabId = await WorkspaceService.CreateTab(this.workspaceId, null, true); |
| 551 | break; |
| 552 | case "switchtab": |
| 553 | tabId = entry.tabId; |
| 554 | if (this.activeTabView?.waveTabId == tabId) { |
| 555 | continue; |
| 556 | } |
| 557 | if (entry.setInBackend) { |
| 558 | await WorkspaceService.SetActiveTab(this.workspaceId, tabId); |
| 559 | } |
| 560 | break; |
| 561 | case "closetab": { |
| 562 | tabId = entry.tabId; |
| 563 | const rtn = await WorkspaceService.CloseTab(this.workspaceId, tabId, true); |
| 564 | if (rtn == null) { |
| 565 | console.log( |
| 566 | "[error] closeTab: no return value", |
| 567 | tabId, |
| 568 | this.workspaceId, |
| 569 | this.waveWindowId |
| 570 | ); |
| 571 | return; |
| 572 | } |
| 573 | this.removeTabViewLater(tabId, 1000); |
| 574 | if (rtn.closewindow) { |
| 575 | this.close(); |
| 576 | return; |
| 577 | } |
| 578 | if (!rtn.newactivetabid) { |
| 579 | return; |
| 580 | } |
| 581 | tabId = rtn.newactivetabid; |
| 582 | break; |
| 583 | } |
| 584 | case "switchworkspace": { |
| 585 | const newWs = await WindowService.SwitchWorkspace(this.waveWindowId, entry.workspaceId); |
| 586 | if (!newWs) { |
| 587 | return; |
| 588 | } |
| 589 | console.log("processActionQueue switchworkspace newWs", newWs); |
| 590 | this.removeAllChildViews(); |
| 591 | console.log("destroyed all tabs", this.waveWindowId); |
| 592 | this.workspaceId = entry.workspaceId; |
| 593 | this.allLoadedTabViews = new Map(); |
| 594 | tabId = newWs.activetabid; |
| 595 | break; |
| 596 | } |
no test coverage detected