()
| 321 | } |
| 322 | |
| 323 | private setupWindowManagement () { |
| 324 | this.window.on('show', () => { |
| 325 | this.visible.next(true) |
| 326 | this.send('host:window-shown') |
| 327 | }) |
| 328 | |
| 329 | this.window.on('hide', () => { |
| 330 | this.visible.next(false) |
| 331 | }) |
| 332 | |
| 333 | const moveSubscription = new Observable<void>(observer => { |
| 334 | this.window.on('move', () => observer.next()) |
| 335 | }).pipe(debounceTime(250)).subscribe(() => { |
| 336 | this.send('host:window-moved') |
| 337 | }) |
| 338 | |
| 339 | this.window.on('closed', () => { |
| 340 | moveSubscription.unsubscribe() |
| 341 | }) |
| 342 | |
| 343 | this.window.on('enter-full-screen', () => this.send('host:window-enter-full-screen')) |
| 344 | this.window.on('leave-full-screen', () => this.send('host:window-leave-full-screen')) |
| 345 | |
| 346 | this.window.on('maximize', () => this.send('host:window-maximized')) |
| 347 | this.window.on('unmaximize', () => this.send('host:window-unmaximized')) |
| 348 | |
| 349 | this.window.on('close', event => { |
| 350 | if (!this.closing) { |
| 351 | event.preventDefault() |
| 352 | this.send('host:window-close-request') |
| 353 | return |
| 354 | } |
| 355 | this.windowConfig.set('windowBoundaries', this.windowBounds) |
| 356 | this.windowConfig.set('maximized', this.window.isMaximized()) |
| 357 | }) |
| 358 | |
| 359 | this.window.on('closed', () => { |
| 360 | this.destroy() |
| 361 | }) |
| 362 | |
| 363 | this.window.on('resize', () => { |
| 364 | if (!this.window.isMaximized()) { |
| 365 | this.windowBounds = this.window.getBounds() |
| 366 | } |
| 367 | }) |
| 368 | |
| 369 | this.window.on('move', () => { |
| 370 | if (!this.window.isMaximized()) { |
| 371 | this.windowBounds = this.window.getBounds() |
| 372 | } |
| 373 | }) |
| 374 | |
| 375 | this.window.on('focus', () => { |
| 376 | this.send('host:window-focused') |
| 377 | }) |
| 378 | |
| 379 | this.on('ready', () => { |
| 380 | this.window?.webContents.send('start', { |
no test coverage detected