From 68cf2bae1f8c5525e6fb38b46408a05c9f75e76e Mon Sep 17 00:00:00 2001 From: zdg Date: Fri, 27 Sep 2024 09:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E6=B3=A8=E9=87=8A=E6=89=93?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.js | 5 ----- src/renderer/src/plugins/shareStore.js | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index f6803fe..a8ce9ec 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -280,14 +280,9 @@ function handleAll() { }) // 用于监听-状态管理变化-同步所有窗口 ipcMain.handle('pinia-state-change', (e, storeName, jsonStr) => { - console.log('pinia-state-change-1', storeName, jsonStr) - for(const curWin of BrowserWindow.getAllWindows()){ const id = curWin.webContents.id const bool = id !== e.sender.id && !curWin.isDestroyed() - if (id === e.sender.id) { - console.log('pinia-state-change-2', 'windows-send', curWin.type) - } if (bool) { // 除了消息发送窗口和销毁的窗口 其他都发送 curWin.webContents.send('pinia-state-set', storeName, jsonStr) } diff --git a/src/renderer/src/plugins/shareStore.js b/src/renderer/src/plugins/shareStore.js index c4c2567..ba893d2 100644 --- a/src/renderer/src/plugins/shareStore.js +++ b/src/renderer/src/plugins/shareStore.js @@ -57,7 +57,7 @@ function stateSyncWatch(storeName, newState) { const diffData = findDifferences(oldState, newState) if(!_.keys(diffData).length) return // 没有变化就终止执行 // 数据处理: 找出差异 - console.log('state-change-diffData', diffData) + // console.log('state-change-diffData', diffData) try { let pinaValue = {} // store pina状态管理需要的数据格式 // 数据转换处理 @@ -116,7 +116,7 @@ function stateSyncInit(wid, store) { function sessionWatch(store) { const unsubscribe = sessionStore.onDidAnyChange((newV, oldV) => { if (newV !== oldV) { - console.log('session-change', newV, oldV) + // console.log('session-change', newV, oldV) // 通知主线程更新 // ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) } @@ -129,7 +129,7 @@ function stateChange(store) { const storeName = store.$id ipcRenderer?.on('pinia-state-set', (e, sName, jsonStr) => { if (sName == storeName) { // 更新对应数据 - console.log('state-set', jsonStr, sName) + // console.log('state-set', jsonStr, sName) const curJson = circularSafeStringify(store.$state) // 当前数据 const isUp = curJson != jsonStr // 不同的时候才写入,不然会导致触发数据变化监听,导致死循环 if (!isUp) return