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

Method poll

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

Source from the content-addressed store, hash-verified

1826 }
1827
1828 poll(): A | MutableList.Empty {
1829 if (this.unsubscribed) {
1830 return MutableList.Empty
1831 }
1832 this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex)
1833 if (this.subscriberIndex !== this.self.publisherIndex) {
1834 const index = this.subscriberIndex & this.self.mask
1835 const elem = this.self.array[index]!
1836 this.self.subscribers[index] -= 1
1837 if (this.self.subscribers[index] === 0) {
1838 this.self.array[index] = AbsentValue as unknown as A
1839 this.self.subscribersIndex += 1
1840 }
1841 this.subscriberIndex += 1
1842 return elem
1843 }
1844 return MutableList.Empty
1845 }
1846
1847 pollUpTo(n: number): Array<A> {
1848 if (this.unsubscribed) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected