bug fixed

This commit is contained in:
richard-loafle 2020-02-20 17:38:27 +09:00
parent 205f71dfea
commit be284a3240

View File

@ -47,7 +47,6 @@ class BrowserWindowPooler {
if (this.minSize < length) { if (this.minSize < length) {
this.start(); this.start();
} }
return length; return length;
} }
@ -55,13 +54,7 @@ class BrowserWindowPooler {
if (!this.inactiveWindows || 0 === this.inactiveWindows.length) { if (!this.inactiveWindows || 0 === this.inactiveWindows.length) {
return undefined; return undefined;
} }
return this.inactiveWindows.pop();
const w = this.inactiveWindows.pop();
if (this.minSize >= this.inactiveWindows.length) {
this.stop();
}
return w;
} }
closeAll() { closeAll() {
@ -72,23 +65,13 @@ class BrowserWindowPooler {
} }
private start() { private start() {
if (!!this.handle) { setTimeout(() => {
this.stop();
}
this.handle = setTimeout(() => {
while (this.minSize < this.inactiveWindows.length) { while (this.minSize < this.inactiveWindows.length) {
const w = this.inactiveWindows.pop(); const w = this.inactiveWindows.pop();
w.close(); w.close();
} }
}, 3000); }, 3000);
} }
private stop() {
if (!!this.handle) {
clearTimeout(this.handle);
this.handle = undefined;
}
}
} }
export class ElectronNotificationService { export class ElectronNotificationService {
@ -451,7 +434,10 @@ export class ElectronNotificationService {
windowProperties.width = slef.customOptions.width; windowProperties.width = slef.customOptions.width;
windowProperties.height = slef.customOptions.height; windowProperties.height = slef.customOptions.height;
const notificationWindow = new BrowserWindow(windowProperties); const notificationWindow = new BrowserWindow({
...windowProperties,
title: 'Notification'
});
notificationWindow.setVisibleOnAllWorkspaces(true); notificationWindow.setVisibleOnAllWorkspaces(true);
notificationWindow.loadURL(slef.templatePath); notificationWindow.loadURL(slef.templatePath);
notificationWindow.webContents.on( notificationWindow.webContents.on(