Skip to content

Commit feb447d

Browse files
committed
fix: prevent RTCDataChannel.close() from blocking the event loop
1 parent dd3954e commit feb447d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/polyfill/RTCDataChannel.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ export default class RTCDataChannel extends EventTarget implements globalThis.RT
191191

192192
close(): void {
193193
this.#closeRequested = true;
194-
this.#dataChannel.close();
194+
setImmediate(() => {
195+
this.#dataChannel.close();
196+
});
195197
}
196198
}

0 commit comments

Comments
 (0)