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

Method pollUpTo

packages/effect/src/PubSub.ts:2014–2025  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected