(value: T)
| 139 | } |
| 140 | |
| 141 | push(value: T): void { |
| 142 | if (this.done) { |
| 143 | return; |
| 144 | } |
| 145 | |
| 146 | const waiter = this.pending.shift(); |
| 147 | if (waiter) { |
| 148 | waiter.resolve({ value, done: false }); |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | if (this.buffered.length >= this.maxBufferedStreamEvents) { |
| 153 | this.cancel(`buffer overflow (maxBufferedStreamEvents=${this.maxBufferedStreamEvents})`); |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | this.buffered.push(value); |
| 158 | } |
| 159 | |
| 160 | end(): void { |
| 161 | if (this.done) { |