* Add the given window to the window list.
(window: BaseWindow)
| 119 | * Add the given window to the window list. |
| 120 | */ |
| 121 | add(window: BaseWindow): void { |
| 122 | const windowId = window.id as number |
| 123 | this._windows.set(windowId, window) |
| 124 | |
| 125 | if (!this._appMenu.has(windowId)) { |
| 126 | this._appMenu.addDefaultMenu(windowId) |
| 127 | } |
| 128 | |
| 129 | if (this.windowCount === 1) { |
| 130 | this.setActiveWindow(windowId) |
| 131 | } |
| 132 | |
| 133 | window.on('window-focus', () => { |
| 134 | this.setActiveWindow(windowId) |
| 135 | }) |
| 136 | window.on('window-closed', () => { |
| 137 | this.remove(windowId) |
| 138 | this._watcher.unwatchByWindowId(windowId) |
| 139 | }) |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Return the application window by id. |