mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-21 17:38:40 +00:00
添加了一些log
This commit is contained in:
parent
153a2f66f1
commit
3cdb4db7cf
@ -9,6 +9,7 @@ class Content {
|
|||||||
private connect: chrome.runtime.Port | null = null;
|
private connect: chrome.runtime.Port | null = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
console.log("init content");
|
||||||
// 接受来自inject.js的消息数据,然后中转到background.js
|
// 接受来自inject.js的消息数据,然后中转到background.js
|
||||||
window.addEventListener("message", (event) => {
|
window.addEventListener("message", (event) => {
|
||||||
let data: PluginEvent = event.data;
|
let data: PluginEvent = event.data;
|
||||||
|
19
cc-inspector/src/scripts/terminal.ts
Normal file
19
cc-inspector/src/scripts/terminal.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
export class Terminal {
|
||||||
|
color = 'red';
|
||||||
|
background = 'yellow';
|
||||||
|
tag = 'terminal';
|
||||||
|
constructor(tag: string, color: string = 'red', background: string = 'yellow') {
|
||||||
|
this.color = color;
|
||||||
|
this.background = background;
|
||||||
|
this.tag = tag;
|
||||||
|
}
|
||||||
|
ok() {
|
||||||
|
this.log(`ok`);
|
||||||
|
}
|
||||||
|
log(message: string) {
|
||||||
|
console.log(`%c${this.tag}%c${message}`, `color:${this.color};background:${this.background};padding:0 4px`, "color:black;margin-left:5px")
|
||||||
|
}
|
||||||
|
connect(msg: string) {
|
||||||
|
this.log(`[connect] ${msg}`);
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,9 @@ import CCP from "cc-plugin/src/ccp/entry-render";
|
|||||||
import { Msg, Page, PluginEvent } from "../../core/types";
|
import { Msg, Page, PluginEvent } from "../../core/types";
|
||||||
import { TestClient, testServer, TestServer } from "./test/server";
|
import { TestClient, testServer, TestServer } from "./test/server";
|
||||||
export type BackgroundCallback = (data: PluginEvent, sender: any) => void;
|
export type BackgroundCallback = (data: PluginEvent, sender: any) => void;
|
||||||
|
if (chrome.devtools) {
|
||||||
|
console.log("chrome devtools")
|
||||||
|
}
|
||||||
class ConnectBackground implements TestClient {
|
class ConnectBackground implements TestClient {
|
||||||
connect: chrome.runtime.Port | null = null;
|
connect: chrome.runtime.Port | null = null;
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -69,7 +69,7 @@ export default defineComponent({
|
|||||||
appStore().init();
|
appStore().init();
|
||||||
const { config } = storeToRefs(appStore());
|
const { config } = storeToRefs(appStore());
|
||||||
const treeItemData = ref<NodeInfoData | null>({ uuid: "", group: [] });
|
const treeItemData = ref<NodeInfoData | null>({ uuid: "", group: [] });
|
||||||
const isShowDebug = ref<boolean>(true);
|
const isShowDebug = ref<boolean>(false);
|
||||||
const frameID = ref<number>(0);
|
const frameID = ref<number>(0);
|
||||||
const iframes = ref<Array<FrameInfo>>([]);
|
const iframes = ref<Array<FrameInfo>>([]);
|
||||||
const btnRefresh: ButtonGroupItem = reactive<ButtonGroupItem>({
|
const btnRefresh: ButtonGroupItem = reactive<ButtonGroupItem>({
|
||||||
@ -172,8 +172,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const elTree = ref<HTMLElement>();
|
const elTree = ref<typeof CCTree>();
|
||||||
|
|
||||||
function _initChromeRuntimeConnect() {
|
function _initChromeRuntimeConnect() {
|
||||||
const msgFunctionMap: Record<string, Function> = {};
|
const msgFunctionMap: Record<string, Function> = {};
|
||||||
msgFunctionMap[Msg.TreeInfo] = (data: Array<TreeData>) => {
|
msgFunctionMap[Msg.TreeInfo] = (data: Array<TreeData>) => {
|
||||||
@ -186,7 +185,7 @@ export default defineComponent({
|
|||||||
updateNodeInfo();
|
updateNodeInfo();
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (elTree.value) {
|
if (elTree.value) {
|
||||||
elTree.value.setCurrentKey(selectedUUID);
|
elTree.value.handChoose(selectedUUID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -423,9 +422,13 @@ export default defineComponent({
|
|||||||
matchCase.value = !matchCase.value;
|
matchCase.value = !matchCase.value;
|
||||||
updateFilterText(filterText);
|
updateFilterText(filterText);
|
||||||
},
|
},
|
||||||
handleNodeClick(data: TreeData) {
|
handleNodeClick(data: TreeData | null) {
|
||||||
|
if (data) {
|
||||||
selectedUUID = data.id;
|
selectedUUID = data.id;
|
||||||
updateNodeInfo();
|
updateNodeInfo();
|
||||||
|
} else {
|
||||||
|
selectedUUID = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// TODO: 暂时这个版本先不实现
|
// TODO: 暂时这个版本先不实现
|
||||||
filterNode(value: any, data: any) {
|
filterNode(value: any, data: any) {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import CCP from "cc-plugin/src/ccp/entry-render";
|
import CCP from "cc-plugin/src/ccp/entry-render";
|
||||||
import { ChromeConst } from "cc-plugin/src/chrome/const";
|
import { ChromeConst } from "cc-plugin/src/chrome/const";
|
||||||
import { Msg, Page, PluginEvent } from "../../core/types";
|
|
||||||
import { connectBackground } from "./connectBackground";
|
|
||||||
export function init() {
|
export function init() {
|
||||||
if (chrome && chrome.devtools) {
|
if (chrome && chrome.devtools) {
|
||||||
// 对应的是Elements面板的边栏
|
// 对应的是Elements面板的边栏
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="show" class="test">
|
<div v-if="show" class="test">
|
||||||
<CCSection name="功能测试">
|
<CCSection name="功能测试" :expand="false">
|
||||||
<CCButton @click="onClickHasCocosGame">Has CocosGame</CCButton>
|
<CCButton @click="onClickHasCocosGame">Has CocosGame</CCButton>
|
||||||
<CCButton @click="onClickNoCocosGame">No CocosGame</CCButton>
|
<CCButton @click="onClickNoCocosGame">No CocosGame</CCButton>
|
||||||
<CCButton @click="onTestTree">init tree data</CCButton>
|
<CCButton @click="onTestTree">init tree data</CCButton>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user