* Create a pending write promise, optionally racing against a signal. * If the signal fires, the entry is removed from pendingWrites and the * promise rejects. Signal listeners are cleaned up on normal resolution. * @returns {Promise }
(chunk, signal)
| 671 | * @returns {Promise<void>} |
| 672 | */ |
| 673 | #createPendingWrite(chunk, signal) { |
| 674 | const { promise, resolve, reject } = PromiseWithResolvers(); |
| 675 | const entry = { __proto__: null, chunk, resolve, reject }; |
| 676 | this.#pendingWrites.push(entry); |
| 677 | if (signal) { |
| 678 | wireBroadcastWriteSignal(entry, signal, resolve, reject, this); |
| 679 | } |
| 680 | return promise; |
| 681 | } |
| 682 | |
| 683 | #resolvePendingWrites() { |
| 684 | while (this.#pendingWrites.length > 0 && this.#broadcast[kCanWrite]()) { |
no test coverage detected