fix: use addEventListener instead of onmessage in portTransport.ts (#29581)
This commit is contained in:
parent
d573c515a3
commit
593feea166
|
|
@ -21,7 +21,7 @@ export class PortTransport {
|
||||||
|
|
||||||
constructor(port: MessagePort, handler: (method: string, params: any) => Promise<any>) {
|
constructor(port: MessagePort, handler: (method: string, params: any) => Promise<any>) {
|
||||||
this._port = port;
|
this._port = port;
|
||||||
port.onmessage = async event => {
|
port.addEventListener('message', async event => {
|
||||||
const message = event.data;
|
const message = event.data;
|
||||||
const { id, ackId, method, params, result } = message;
|
const { id, ackId, method, params, result } = message;
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|
@ -36,7 +36,7 @@ export class PortTransport {
|
||||||
callback?.(result);
|
callback?.(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(method: string, params: any) {
|
async send(method: string, params: any) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue