fix #107652
This commit is contained in:
parent
29a999424b
commit
244934ed10
3 changed files with 8 additions and 1 deletions
|
@ -74,7 +74,7 @@ export class NativeHostMainService implements INativeHostMainService {
|
|||
|
||||
//#region Events
|
||||
|
||||
readonly onWindowOpen = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-created', (event, window: BrowserWindow) => window.id), windowId => !!this.windowsMainService.getWindowById(windowId));
|
||||
readonly onWindowOpen = Event.map(this.windowsMainService.onWindowOpened, window => window.id);
|
||||
|
||||
readonly onWindowMaximize = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-maximize', (event, window: BrowserWindow) => window.id), windowId => !!this.windowsMainService.getWindowById(windowId));
|
||||
readonly onWindowUnmaximize = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-unmaximize', (event, window: BrowserWindow) => window.id), windowId => !!this.windowsMainService.getWindowById(windowId));
|
||||
|
|
|
@ -98,6 +98,7 @@ export interface IWindowsMainService {
|
|||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
readonly onWindowOpened: Event<ICodeWindow>;
|
||||
readonly onWindowReady: Event<ICodeWindow>;
|
||||
readonly onWindowsCountChanged: Event<IWindowsCountChangedEvent>;
|
||||
|
||||
|
|
|
@ -163,6 +163,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
|
||||
private shuttingDown = false;
|
||||
|
||||
private readonly _onWindowOpened = this._register(new Emitter<ICodeWindow>());
|
||||
readonly onWindowOpened = this._onWindowOpened.event;
|
||||
|
||||
private readonly _onWindowReady = this._register(new Emitter<ICodeWindow>());
|
||||
readonly onWindowReady = this._onWindowReady.event;
|
||||
|
||||
|
@ -1416,6 +1419,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
// Add to our list of windows
|
||||
WindowsMainService.WINDOWS.push(createdWindow);
|
||||
|
||||
// Indicate new window via event
|
||||
this._onWindowOpened.fire(createdWindow);
|
||||
|
||||
// Indicate number change via event
|
||||
this._onWindowsCountChanged.fire({ oldCount: WindowsMainService.WINDOWS.length - 1, newCount: WindowsMainService.WINDOWS.length });
|
||||
|
||||
|
|
Loading…
Reference in a new issue