From a0fc514ac907e672e40da859e597a7e971b28c13 Mon Sep 17 00:00:00 2001 From: xu_yanfeng Date: Thu, 8 May 2025 14:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B7=E6=96=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BC=9A=E8=A2=AB=E9=87=8D=E7=BD=AE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/devtools/hierarchy.vue | 4 ++-- src/views/devtools/inspector.vue | 2 +- src/views/devtools/timer.ts | 16 +++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/views/devtools/hierarchy.vue b/src/views/devtools/hierarchy.vue index d54edf7..15b0366 100644 --- a/src/views/devtools/hierarchy.vue +++ b/src/views/devtools/hierarchy.vue @@ -116,10 +116,10 @@ export default defineComponent({ Bus.off(BusMsg.ShowPlace, funcShowPlace); Bus.off(BusMsg.EnableSchedule, funcEnableSchedule); bridge.off(Msg.InspectNode, onInspectNode); - timer.clean(); + timer.destroy(); }); function updateTree() { - console.log("update tree info"); + // console.log("update tree info"); const id = toRaw(frameID.value); bridge.send(Msg.RequstTreeInfo, { frameID: id } as RequestTreeInfoData); } diff --git a/src/views/devtools/inspector.vue b/src/views/devtools/inspector.vue index aa96f07..4583a9c 100644 --- a/src/views/devtools/inspector.vue +++ b/src/views/devtools/inspector.vue @@ -84,7 +84,7 @@ export default defineComponent({ Bus.off(BusMsg.ChangeContent, changeContent); Bus.off(BusMsg.SelectNode, funSelectNode); Bus.off(BusMsg.EnableSchedule, funcEnableSchedule); - timer.clean(); + timer.destroy(); }); bridge.on(Msg.ResponseSupport, (event: PluginEvent) => { let data: ResponseSupportData = event.data; diff --git a/src/views/devtools/timer.ts b/src/views/devtools/timer.ts index cc928c4..759a34f 100644 --- a/src/views/devtools/timer.ts +++ b/src/views/devtools/timer.ts @@ -18,12 +18,18 @@ export class Timer { this.onWork && this.onWork(); } } - clean() { + destroy(): boolean { if (this.timer === null) { - return; + return false; + } else { + clearInterval(this.timer); + this.timer = null; + return true; + } + } + clean() { + if (this.destroy()) { + this.onClean && this.onClean(); } - clearInterval(this.timer); - this.timer = null; - this.onClean && this.onClean(); } }