()
| 1999 | } |
| 2000 | |
| 2001 | poll(): A | MutableList.Empty { |
| 2002 | if (this.isEmpty()) { |
| 2003 | return MutableList.Empty |
| 2004 | } |
| 2005 | const elem = this.self.value |
| 2006 | this.self.subscribers -= 1 |
| 2007 | if (this.self.subscribers === 0) { |
| 2008 | this.self.value = AbsentValue as unknown as A |
| 2009 | } |
| 2010 | this.subscriberIndex += 1 |
| 2011 | return elem |
| 2012 | } |
| 2013 | |
| 2014 | pollUpTo(n: number): Array<A> { |
| 2015 | if (this.isEmpty() || n < 1) { |