@@ -25,7 +25,7 @@ import CommonEvent, { Emitter } from 'vs/base/common/event';
2525import product from 'vs/platform/node/product' ;
2626import { ITelemetryService , ITelemetryData } from 'vs/platform/telemetry/common/telemetry' ;
2727import { isEqual } from 'vs/base/common/paths' ;
28- import { IWindowsMainService , IOpenConfiguration } from "vs/platform/windows/electron-main/windows" ;
28+ import { IWindowsMainService , IOpenConfiguration , IWindowsCountChangedEvent } from "vs/platform/windows/electron-main/windows" ;
2929import { IHistoryMainService } from "vs/platform/history/common/history" ;
3030import { IProcessEnvironment , isLinux , isMacintosh , isWindows } from 'vs/base/common/platform' ;
3131import { TPromise } from "vs/base/common/winjs.base" ;
@@ -122,6 +122,9 @@ export class WindowsManager implements IWindowsMainService {
122122 private _onWindowReload = new Emitter < number > ( ) ;
123123 onWindowReload : CommonEvent < number > = this . _onWindowReload . event ;
124124
125+ private _onWindowsCountChanged = new Emitter < IWindowsCountChangedEvent > ( ) ;
126+ onWindowsCountChanged : CommonEvent < IWindowsCountChangedEvent > = this . _onWindowsCountChanged . event ;
127+
125128 constructor (
126129 @ILogService private logService : ILogService ,
127130 @IStorageService private storageService : IStorageService ,
@@ -970,8 +973,12 @@ export class WindowsManager implements IWindowsMainService {
970973 isExtensionTestHost : ! ! configuration . extensionTestsPath
971974 } ) ;
972975
976+ // Add to our list of windows
973977 WindowsManager . WINDOWS . push ( codeWindow ) ;
974978
979+ // Indicate number change via event
980+ this . _onWindowsCountChanged . fire ( { oldCount : WindowsManager . WINDOWS . length - 1 , newCount : WindowsManager . WINDOWS . length } ) ;
981+
975982 // Window Events
976983 codeWindow . win . webContents . removeAllListeners ( 'devtools-reload-page' ) ; // remove built in listener so we can handle this on our own
977984 codeWindow . win . webContents . on ( 'devtools-reload-page' , ( ) => this . reload ( codeWindow ) ) ;
@@ -1293,6 +1300,7 @@ export class WindowsManager implements IWindowsMainService {
12931300 WindowsManager . WINDOWS . splice ( index , 1 ) ;
12941301
12951302 // Emit
1303+ this . _onWindowsCountChanged . fire ( { oldCount : WindowsManager . WINDOWS . length + 1 , newCount : WindowsManager . WINDOWS . length } ) ;
12961304 this . _onWindowClose . fire ( win . id ) ;
12971305 }
12981306
0 commit comments