diff --git a/src/messaging/PortMessageHandler.ts b/src/messaging/PortMessageHandler.ts index 08ade69..09880c6 100644 --- a/src/messaging/PortMessageHandler.ts +++ b/src/messaging/PortMessageHandler.ts @@ -51,10 +51,10 @@ class PortMessageHandler { const { resolve, timer } = this.messageMap.get(msgId)!; // 清除超时定时器 clearTimeout(timer); - // 通过 ID 找到对应的 Promise 并 resolve - resolve(res!.data!); // 处理完毕后,移除该消息 ID this.messageMap.delete(msgId); + // 通过 ID 找到对应的 Promise 并 resolve + resolve(res!.data!); } } });