diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 0b3381ef..aa9b99a6 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -1469,8 +1469,6 @@ export class BrowserWindow { } }); - - // let isQuiting = false win.on("minimize", (e: any) => { console.log("[Window - App.ts]", "Minimized") if (process.platform !== "darwin" && utils.getStoreValue("general.close_button_hide")) { @@ -1487,16 +1485,16 @@ export class BrowserWindow { e.preventDefault() win.hide() } - win.webContents.executeJavaScript(` - window.localStorage.setItem("currentTrack", JSON.stringify(app.mk.nowPlayingItem)); - window.localStorage.setItem("currentTime", JSON.stringify(app.mk.currentPlaybackTime)); - window.localStorage.setItem("currentQueue", JSON.stringify(app.mk.queue._unplayedQueueItems)); - ipcRenderer.send('stopGCast','');`) }) app.on('before-quit', () => { console.log("[Window - App.ts] Before Quit") - isQuitting = true + isQuitting = true; + win.webContents.executeJavaScript(` + window.localStorage.setItem("currentTrack", JSON.stringify(app.mk.nowPlayingItem)); + window.localStorage.setItem("currentTime", JSON.stringify(app.mk.currentPlaybackTime)); + window.localStorage.setItem("currentQueue", JSON.stringify(app.mk.queue._unplayedQueueItems)); + ipcRenderer.send('stopGCast','');`) }); app.on('activate', function () { @@ -1511,22 +1509,6 @@ export class BrowserWindow { } }) - // BrowserWindow.win.on("close", (event: Event) => { - // if ((utils.getStoreValue('general.close_button_hide') || process.platform === "darwin") && !isQuiting) { - // event.preventDefault(); - // BrowserWindow.win.hide(); - // } else { - // BrowserWindow.win.webContents.executeJavaScript(` - // window.localStorage.setItem("currentTrack", JSON.stringify(app.mk.nowPlayingItem)); - // window.localStorage.setItem("currentTime", JSON.stringify(app.mk.currentPlaybackTime)); - // window.localStorage.setItem("currentQueue", JSON.stringify(app.mk.queue._unplayedQueueItems)); - // ipcRenderer.send('stopGCast','');`) - // BrowserWindow.win.destroy(); - // } - // }) - - - // Set window Handler BrowserWindow.win.webContents.setWindowOpenHandler((x: any) => { if (x.url.includes("apple") || x.url.includes("localhost")) { diff --git a/src/renderer/main/app.js b/src/renderer/main/app.js index 8e67e2c2..5698d739 100644 --- a/src/renderer/main/app.js +++ b/src/renderer/main/app.js @@ -19,10 +19,6 @@ window.CiderCache = CiderCache window.CiderFrontAPI = CiderFrontAPI window.wsapi = wsapi -window.onbeforeunload = () => { - console.log("[app] onbeforeunload") -} - if (app.cfg.advanced.disableLogging === true) { window.console = { log: function() {},