(n: number)
| 2012 | } |
| 2013 | |
| 2014 | pollUpTo(n: number): Array<A> { |
| 2015 | if (this.isEmpty() || n < 1) { |
| 2016 | return [] |
| 2017 | } |
| 2018 | const a = this.self.value |
| 2019 | this.self.subscribers -= 1 |
| 2020 | if (this.self.subscribers === 0) { |
| 2021 | this.self.value = AbsentValue as unknown as A |
| 2022 | } |
| 2023 | this.subscriberIndex += 1 |
| 2024 | return [a] |
| 2025 | } |
| 2026 | |
| 2027 | unsubscribe(): void { |
| 2028 | if (!this.unsubscribed) { |