完成实时监控的逻辑

This commit is contained in:
xuyanfeng 2021-05-11 21:26:36 +08:00
parent e5e38d92b9
commit bd0ac9b6a4
2 changed files with 7 additions and 7 deletions

View File

@ -116,7 +116,7 @@ export default class Index extends Vue {
if (data) { if (data) {
// //
if (this.treeData.length === 0) { if (this.treeData.length === 0) {
// this.onBtnClickUpdateTree(); this.onBtnClickUpdateTree();
} }
} else { } else {
this._reset(); this._reset();
@ -197,8 +197,6 @@ export default class Index extends Vue {
handleNodeClick(data: TreeData) { handleNodeClick(data: TreeData) {
this.selectedUUID = data.uuid; this.selectedUUID = data.uuid;
// todo
// console.log(data);
let uuid = data.uuid; let uuid = data.uuid;
if (uuid !== undefined) { if (uuid !== undefined) {
this.runToContentScript(Msg.NodeInfo, uuid); this.runToContentScript(Msg.NodeInfo, uuid);
@ -209,11 +207,13 @@ export default class Index extends Vue {
if (this.watchEveryTime) { if (this.watchEveryTime) {
this.timerID = setInterval(() => { this.timerID = setInterval(() => {
this.onBtnClickUpdateTree(); this.onBtnClickUpdateTree();
}, 100); if (this.selectedUUID) {
this.runToContentScript(Msg.NodeInfo, this.selectedUUID);
}
}, 300);
} else { } else {
clearInterval(this.timerID); clearInterval(this.timerID);
} }
} }
runToContentScript(msg: Msg, data?: any) { runToContentScript(msg: Msg, data?: any) {

View File

@ -19,13 +19,13 @@ class CCInspector {
init() { init() {
console.log('cc-inspector init ~~~'); console.log('cc-inspector init ~~~');
// 注册cc_after_render事件
let timer = setInterval(() => { let timer = setInterval(() => {
if (this._isCocosGame()) { if (this._isCocosGame()) {
clearInterval(timer) clearInterval(timer)
// @ts-ignore // @ts-ignore
cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, () => { cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, () => {
console.log('scene launch') let isCocosGame = this._isCocosGame();
this.notifySupportGame(isCocosGame)
}) })
} }
}, 300) }, 300)