fix: use addEventListener instead of onmessage in portTransport.ts (#29581)

This commit is contained in:
David 2024-02-20 11:04:26 -07:00 committed by GitHub
parent d573c515a3
commit 593feea166
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,7 +21,7 @@ export class PortTransport {
constructor(port: MessagePort, handler: (method: string, params: any) => Promise<any>) {
this._port = port;
port.onmessage = async event => {
port.addEventListener('message', async event => {
const message = event.data;
const { id, ackId, method, params, result } = message;
if (id) {
@ -36,7 +36,7 @@ export class PortTransport {
callback?.(result);
return;
}
};
});
}
async send(method: string, params: any) {