watch is cocos game

This commit is contained in:
xyf-mac 2021-11-18 22:49:11 +08:00
parent 6abafd413c
commit e2b3cbfe8e

View File

@ -30,9 +30,8 @@ declare const cc: any;
class CCInspector {
inspectorGameMemoryStorage: Record<string, any> = {}
init() {
console.log("cc-inspector init ~~~");
let timer = setInterval(() => {
private watchIsCocosGame() {
const timer = setInterval(() => {
if (this._isCocosGame()) {
clearInterval(timer)
// @ts-ignore
@ -42,6 +41,11 @@ class CCInspector {
})
}
}, 300)
}
init() {
console.log("cc-inspector init ~~~");
this.watchIsCocosGame();
window.addEventListener("message", (event) => {
// 接受来自content的事件有可能也会受到其他插件的
if (!event || !event.data) {