parent
db14c9283f
commit
487dac4f16
@ -1,23 +0,0 @@
|
||||
export function getBroadcastPlugin() {
|
||||
const electron = window.require("electron");
|
||||
const ipcRenderer = electron.ipcRenderer;
|
||||
|
||||
return (store) => {
|
||||
// 第一行初始化第一次的状态
|
||||
ipcRenderer.send("vuex-state", store.state);
|
||||
store.subscribe(
|
||||
(
|
||||
mutation,
|
||||
{ data = "", settings = "", player = {}, contextMenu = {}, liked = {} }
|
||||
) => {
|
||||
const copyState = { data, settings, player, contextMenu, liked };
|
||||
ipcRenderer.send("vuex-state", copyState);
|
||||
}
|
||||
);
|
||||
store.subscribe((mutation, state) => {
|
||||
if (mutation.type === "updateData") {
|
||||
ipcRenderer.send("updateData", state.data);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
Loading…
Reference in new issue