(value: T)
| 180 | constructor(private readonly capacity: number) {} |
| 181 | |
| 182 | tryPush(value: T): boolean { |
| 183 | if (this.closed) { |
| 184 | return false |
| 185 | } |
| 186 | const waiter = this.waiters.shift() |
| 187 | if (waiter) { |
| 188 | waiter(value) |
| 189 | return true |
| 190 | } |
| 191 | if (this.queue.length >= this.capacity) { |
| 192 | return false |
| 193 | } |
| 194 | this.queue.push(value) |
| 195 | return true |
| 196 | } |
| 197 | |
| 198 | pushLossless(value: T): boolean { |
| 199 | if (this.closed) { |