perf: 注释定时同步

This commit is contained in:
潘潘 2022-11-13 23:29:43 +08:00 committed by 奔跑的面条
parent f8229a0518
commit adbdad1e88
2 changed files with 8 additions and 7 deletions

View File

@ -20,11 +20,11 @@ const useSyncUpdateHandle = () => {
// 开启侦听 // 开启侦听
const use = () => { const use = () => {
// 1、定时同步数据 // // 1、定时同步数据
timer = setInterval(() => { // timer = setInterval(() => {
// 窗口激活并且处于工作台 // // 窗口激活并且处于工作台
document.hasFocus() && syncData() // document.hasFocus() && syncData()
}, editToJsonInterval) // }, editToJsonInterval)
// 2、失焦同步数据 // 2、失焦同步数据
addEventListener('blur', syncData) addEventListener('blur', syncData)
@ -34,7 +34,7 @@ const useSyncUpdateHandle = () => {
// 关闭侦听 // 关闭侦听
const unUse = () => { const unUse = () => {
clearInterval(timer) // clearInterval(timer)
removeEventListener(SavePageEnum.JSON, updateFn) removeEventListener(SavePageEnum.JSON, updateFn)
removeEventListener('blur', syncData) removeEventListener('blur', syncData)
} }

View File

@ -137,7 +137,8 @@ const toolsMouseoutHandle = () => {
// //
const editHandle = () => { const editHandle = () => {
window['$message'].warning('将开启失焦更新与 5 秒同步更新!') window['$message'].warning('将开启失焦更新!')
// window['$message'].warning(' 5 ')
setTimeout(() => { setTimeout(() => {
// id // id
const path = fetchPathByName(EditEnum.CHART_EDIT_NAME, 'href') const path = fetchPathByName(EditEnum.CHART_EDIT_NAME, 'href')