자동업데이트 보완코드 삽입. exception 처리분.

This commit is contained in:
leejinho 2020-04-03 10:32:06 +09:00
parent 4d816c6e54
commit e3b26549cc
2 changed files with 14 additions and 4 deletions

View File

@ -84,9 +84,17 @@ export class ElectronUpdateWindowService {
} }
setDownloadValue(value: number, total: number) { setDownloadValue(value: number, total: number) {
if (!this.browserWindow || this.browserWindow.isDestroyed()) {
return;
}
this.browserWindow.webContents.send(Channel.downloadProcess, value, total); this.browserWindow.webContents.send(Channel.downloadProcess, value, total);
} }
setDownloadComplete() { setDownloadComplete() {
if (!this.browserWindow || this.browserWindow.isDestroyed()) {
return;
}
this.browserWindow.webContents.send(Channel.downloadComplete); this.browserWindow.webContents.send(Channel.downloadComplete);
} }
close() { close() {

View File

@ -959,10 +959,12 @@ autoUpdater.on('update-downloaded', info => {
const browserWindows = BrowserWindow.getAllWindows(); const browserWindows = BrowserWindow.getAllWindows();
// https://github.com/electron-userland/electron-builder/issues/1604#issuecomment-372091881 // https://github.com/electron-userland/electron-builder/issues/1604#issuecomment-372091881
browserWindows.forEach(browserWindow => { if (!!browserWindows && browserWindows.length > 0) {
browserWindow.removeAllListeners(ElectronBrowserWindowChannel.Close); browserWindows.forEach(browserWindow => {
browserWindow.removeAllListeners(ElectronBrowserWindowChannel.Closed); browserWindow.removeAllListeners(ElectronBrowserWindowChannel.Close);
}); browserWindow.removeAllListeners(ElectronBrowserWindowChannel.Closed);
});
}
setTimeout(() => { setTimeout(() => {
updateWindowService.close(); updateWindowService.close();