(ms: number, signal?: AbortSignal)
| 545 | }, ms); |
| 546 | |
| 547 | const onAbort = () => { |
| 548 | cleanup(); |
| 549 | reject(new DOMException("Operation aborted", "AbortError")); |
| 550 | }; |
| 551 | |
| 552 | const cleanup = () => { |
| 553 | clearTimeout(timer); |
| 554 | signal?.removeEventListener("abort", onAbort); |
| 555 | }; |
| 556 | |
| 557 | signal?.addEventListener("abort", onAbort, { once: true }); |
| 558 | }); |
| 559 | } |
| 560 | |
| 561 | // ====== Group forwarding helpers ====== |
| 562 | const groupBuffers = new Map< |
| 563 | string, |
| 564 | { |
| 565 | messages: any[]; |
| 566 | timer: TimerHandle | null; |
| 567 | sourceId: number; |
| 568 | targetId: number; |
| 569 | options?: { silent?: boolean; replyTo?: number }; |
| 570 | shouldForward?: boolean; |
| 571 | disposeTimer?: () => void | Promise<void>; |
| 572 | } |
| 573 | >(); |
| 574 | |
| 575 | function cleanupGroupBuffers(): void { |
no test coverage detected