fix: remove vuexCopy

master
qier222 4 years ago
parent db14c9283f
commit 487dac4f16

@ -2,13 +2,6 @@ import { app, ipcMain } from "electron";
import match from "@njzy/unblockneteasemusic"; import match from "@njzy/unblockneteasemusic";
export function initIpcMain(win) { export function initIpcMain(win) {
// Make vuex copy for electron.
global.vuexCopy = null;
// 同步 vuex 状态,由于 player 有循环引用问题,拷贝部分属性
ipcMain.on("vuex-state", (e, state) => {
global.vuexCopy = state;
});
ipcMain.on("unblock-music", (event, track) => { ipcMain.on("unblock-music", (event, track) => {
// 兼容 unblockneteasemusic 所使用的 api 字段 // 兼容 unblockneteasemusic 所使用的 api 字段
track.alias = track.alia || []; track.alias = track.alia || [];

@ -7,7 +7,6 @@ import { changeAppearance } from "@/utils/common";
import updateApp from "@/utils/updateApp"; import updateApp from "@/utils/updateApp";
import Player from "@/utils/Player"; import Player from "@/utils/Player";
// vuex 自定义插件 // vuex 自定义插件
import { getBroadcastPlugin } from "./plugins/broadcast";
import saveToLocalStorage from "./plugins/localStorage"; import saveToLocalStorage from "./plugins/localStorage";
updateApp(); updateApp();
@ -15,11 +14,6 @@ updateApp();
Vue.use(Vuex); Vue.use(Vuex);
let plugins = [saveToLocalStorage]; let plugins = [saveToLocalStorage];
if (process.env.IS_ELECTRON === true) {
let vuexBroadCast = getBroadcastPlugin();
plugins.push(vuexBroadCast);
}
const options = { const options = {
state, state,
mutations, mutations,

@ -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…
Cancel
Save