MCPcopy Create free account
hub / github.com/Effect-TS/effect / poll

Method poll

packages/effect/src/PubSub.ts:2001–2012  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected