重新梳理Inject/Content的逻辑

This commit is contained in:
xu_yanfeng
2024-12-27 14:14:38 +08:00
parent b29e39a612
commit ae59ee5a10
17 changed files with 872 additions and 825 deletions

View File

@@ -30,10 +30,12 @@ class Bridge implements TestClient {
})
this.connect.onMessage.addListener((event, sender: chrome.runtime.Port) => {
console.log(...this.terminal.message(JSON.stringify(event)));
const data = PluginEvent.create(event);
if (this.onMessage) {
console.log(...this.terminal.chunkMessage(data.toChunk()));
if (data.valid && this.onMessage) {
this.onMessage(data, sender);
} else {
console.log(JSON.stringify(event));
}
});

View File

@@ -395,7 +395,7 @@ export default defineComponent({
bridge.send(Msg.TreeInfo, id);
}
function onChangeFrame() {
const id = toRaw(frameID.value);
const id = Number(toRaw(frameID.value));
bridge.send(Msg.UseFrame, id);
}
const elLeft = ref<HTMLDivElement>();

View File

@@ -84,7 +84,7 @@ export default defineComponent({
console.log(...t.red("red"));
console.log(...t.green("green"));
console.log(...t.blue("blue"));
console.log(...t.chunk(event.toChunk()));
console.log(...t.chunkMessage(event.toChunk()));
},
onTestTree() {
const data: TreeData = {