This commit is contained in:
vapormusic 2021-12-25 13:51:03 +07:00
commit f6b0b4da8c

View file

@ -109,6 +109,7 @@ class NavigationEvent {
const app = new Vue({ const app = new Vue({
el: "#app", el: "#app",
data: { data: {
cfg: ipcRenderer.sendSync("getStore"),
isDev: ipcRenderer.sendSync("is-dev"), isDev: ipcRenderer.sendSync("is-dev"),
drawertest: false, drawertest: false,
platform: "", platform: "",
@ -247,6 +248,13 @@ const app = new Vue({
}, },
}, },
watch: { watch: {
cfg: {
handler: function (val, oldVal) {
console.log(`cfg changed from ${oldVal} to ${val}`);
ipcRenderer.send("setStore", val);
},
deep: true
},
page: () => { page: () => {
document.getElementById("app-content").scrollTo(0, 0); document.getElementById("app-content").scrollTo(0, 0);
app.resetState() app.resetState()
@ -321,9 +329,10 @@ const app = new Vue({
} }
// Set the volume // Set the volume
ipcRenderer.invoke('getStoreValue', 'general.volume').then((value) => { this.mk.volume = this.cfg.general.volume
self.mk.volume = value // ipcRenderer.invoke('getStoreValue', 'general.volume').then((value) => {
}) // self.mk.volume = value
// })
// load cached library // load cached library
if (localStorage.getItem("librarySongs") != null) { if (localStorage.getItem("librarySongs") != null) {
@ -430,8 +439,9 @@ const app = new Vue({
}) })
this.mk.addEventListener(MusicKit.Events.playbackVolumeDidChange, (_a) => { this.mk.addEventListener(MusicKit.Events.playbackVolumeDidChange, (_a) => {
ipcRenderer.invoke('setStoreValue', 'general.volume', this.mk.volume) this.cfg.general.volume = this.mk.volume
}) })
this.refreshPlaylists() this.refreshPlaylists()