integrated electron-store cfg into vue
This commit is contained in:
parent
59d7de2151
commit
94e73a2d7d
1 changed files with 14 additions and 4 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue