From be284a3240fd8ba3b612330afd396e20b8e0e4c0 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Thu, 20 Feb 2020 17:38:27 +0900 Subject: [PATCH] bug fixed --- .../services/electron-notification.service.ts | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron-notification/src/lib/services/electron-notification.service.ts b/electron-projects/ucap-webmessenger-electron-notification/src/lib/services/electron-notification.service.ts index fbfcceea..b6c11b7a 100644 --- a/electron-projects/ucap-webmessenger-electron-notification/src/lib/services/electron-notification.service.ts +++ b/electron-projects/ucap-webmessenger-electron-notification/src/lib/services/electron-notification.service.ts @@ -47,7 +47,6 @@ class BrowserWindowPooler { if (this.minSize < length) { this.start(); } - return length; } @@ -55,13 +54,7 @@ class BrowserWindowPooler { if (!this.inactiveWindows || 0 === this.inactiveWindows.length) { return undefined; } - - const w = this.inactiveWindows.pop(); - if (this.minSize >= this.inactiveWindows.length) { - this.stop(); - } - - return w; + return this.inactiveWindows.pop(); } closeAll() { @@ -72,23 +65,13 @@ class BrowserWindowPooler { } private start() { - if (!!this.handle) { - this.stop(); - } - this.handle = setTimeout(() => { + setTimeout(() => { while (this.minSize < this.inactiveWindows.length) { const w = this.inactiveWindows.pop(); w.close(); } }, 3000); } - - private stop() { - if (!!this.handle) { - clearTimeout(this.handle); - this.handle = undefined; - } - } } export class ElectronNotificationService { @@ -451,7 +434,10 @@ export class ElectronNotificationService { windowProperties.width = slef.customOptions.width; windowProperties.height = slef.customOptions.height; - const notificationWindow = new BrowserWindow(windowProperties); + const notificationWindow = new BrowserWindow({ + ...windowProperties, + title: 'Notification' + }); notificationWindow.setVisibleOnAllWorkspaces(true); notificationWindow.loadURL(slef.templatePath); notificationWindow.webContents.on(