Moved state saving to before quit
This commit is contained in:
parent
f50247d923
commit
f30c905a4b
2 changed files with 6 additions and 28 deletions
|
@ -1469,8 +1469,6 @@ export class BrowserWindow {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// let isQuiting = false
|
|
||||||
win.on("minimize", (e: any) => {
|
win.on("minimize", (e: any) => {
|
||||||
console.log("[Window - App.ts]", "Minimized")
|
console.log("[Window - App.ts]", "Minimized")
|
||||||
if (process.platform !== "darwin" && utils.getStoreValue("general.close_button_hide")) {
|
if (process.platform !== "darwin" && utils.getStoreValue("general.close_button_hide")) {
|
||||||
|
@ -1487,16 +1485,16 @@ export class BrowserWindow {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
win.hide()
|
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', () => {
|
app.on('before-quit', () => {
|
||||||
console.log("[Window - App.ts] 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 () {
|
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
|
// Set window Handler
|
||||||
BrowserWindow.win.webContents.setWindowOpenHandler((x: any) => {
|
BrowserWindow.win.webContents.setWindowOpenHandler((x: any) => {
|
||||||
if (x.url.includes("apple") || x.url.includes("localhost")) {
|
if (x.url.includes("apple") || x.url.includes("localhost")) {
|
||||||
|
|
|
@ -19,10 +19,6 @@ window.CiderCache = CiderCache
|
||||||
window.CiderFrontAPI = CiderFrontAPI
|
window.CiderFrontAPI = CiderFrontAPI
|
||||||
window.wsapi = wsapi
|
window.wsapi = wsapi
|
||||||
|
|
||||||
window.onbeforeunload = () => {
|
|
||||||
console.log("[app] onbeforeunload")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app.cfg.advanced.disableLogging === true) {
|
if (app.cfg.advanced.disableLogging === true) {
|
||||||
window.console = {
|
window.console = {
|
||||||
log: function() {},
|
log: function() {},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue