This commit is contained in:
IndieKKY
2024-10-05 21:02:47 +08:00
parent b44a73cd2f
commit 4f03e75b6d
5 changed files with 2 additions and 23 deletions

View File

@@ -71,7 +71,7 @@ class ExtensionMessage {
const id = crypto.randomUUID()
const name = port.name
const portMessageHandler = new Layer1Protocol<MessageData, MessageResult>(async (value: MessageData) => {
// 初始化
// 初始化消息
if (value.method === '_init') {
const type = value.params.type
let tabId = value.params.tabId
@@ -95,6 +95,7 @@ class ExtensionMessage {
} as MessageResult
}
// 处理消息
return handler(value, portContext)
}, port)
const portContext: PortContext = {id, name, port, portMessageHandler, ready: false}