Update browserwindow.ts

This commit is contained in:
booploops 2022-03-14 12:24:43 -07:00
parent cb18c1c098
commit 49633ab255

View file

@ -1127,15 +1127,15 @@ export class BrowserWindow {
let isQuiting = false let isQuiting = false
BrowserWindow.win.on("close", (event: Event) => { BrowserWindow.win.on("close", (event: Event) => {
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.items));
ipcRenderer.send('stopGCast','');`)
if ((utils.getStoreValue('general.close_button_hide') || process.platform === "darwin") && !isQuiting) { if ((utils.getStoreValue('general.close_button_hide') || process.platform === "darwin") && !isQuiting) {
event.preventDefault(); event.preventDefault();
BrowserWindow.win.hide(); BrowserWindow.win.hide();
} else { } 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.items));
ipcRenderer.send('stopGCast','');`)
BrowserWindow.win.destroy(); BrowserWindow.win.destroy();
} }
}) })