Vanessa 2023-03-19 12:18:25 +08:00
parent 988fb70691
commit 1ec4bb950c

View file

@ -57,6 +57,7 @@ const exitApp = (port, errorWindowId) => {
// 关闭端口相同的所有非主窗口 // 关闭端口相同的所有非主窗口
BrowserWindow.getAllWindows().forEach((item) => { BrowserWindow.getAllWindows().forEach((item) => {
try {
const currentURL = new URL(item.getURL()) const currentURL = new URL(item.getURL())
if (port.toString() === currentURL.port.toString()) { if (port.toString() === currentURL.port.toString()) {
if (currentURL.href.indexOf("/stage/build/app/?v=") > -1) { if (currentURL.href.indexOf("/stage/build/app/?v=") > -1) {
@ -65,6 +66,9 @@ const exitApp = (port, errorWindowId) => {
item.destroy(); item.destroy();
} }
} }
} catch (e) {
// load file is not a url
}
}); });
workspaces.find((item, index) => { workspaces.find((item, index) => {
if (mainWindow.id === item.browserWindow.id) { if (mainWindow.id === item.browserWindow.id) {