Creates IPC listeners in app start()

Moved out of the constructor in the case when the windows are reloaded. Fixes an issue where a system error causes IPC messages to be ignored because they are not recreated.
This commit is contained in:
Shiran Pasternak 2024-08-28 16:45:44 -04:00
Родитель a290a3b661
Коммит 13cddff133
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -70,9 +70,6 @@ export class BatchExplorerApplication {
this.appReady = new Deferred<void>();
this.userSettings = configurationStore.config;
ipcMain.on(IpcEvent.login, () => this.login());
ipcMain.on(IpcEvent.logout, () => this.logout());
}
public async init() {
@ -127,6 +124,9 @@ export class BatchExplorerApplication {
});
await this.appReady.promise;
this.ipcMain.on(IpcEvent.login, () => this.login());
this.ipcMain.on(IpcEvent.logout, () => this.logout());
windowSub.unsubscribe();
window.show();
@ -300,7 +300,7 @@ export class BatchExplorerApplication {
// eslint-disable-next-line @typescript-eslint/ban-types
process.on("uncaughtException" as any, (error: Error) => {
log.error("There was a uncaught exception", error);
log.error("There was an uncaught exception", error);
this.recoverWindow.createWithError(error.message);
this.telemetryService.trackError(error);
this.telemetryService.flush(true);