Hyperlinkv0.8.0-beta.28

PubSub

PubSub.isShutdownconsteffect/PubSub.ts:794
<A>(self: PubSub<A>): Effect.Effect<boolean>

Checks effectfully whether shutdown has been called, returning true after shutdown and false otherwise.

Example (Checking whether a PubSub is shut down)

import { Effect, PubSub } from "effect"

const program = Effect.gen(function*() {
  const pubsub = yield* PubSub.bounded<string>(10)

  // Initially not shutdown
  const initiallyShutdown = yield* PubSub.isShutdown(pubsub)
  console.log("Initially shutdown:", initiallyShutdown) // false

  // Shutdown the PubSub
  yield* PubSub.shutdown(pubsub)

  const nowShutdown = yield* PubSub.isShutdown(pubsub)
  console.log("Now shutdown:", nowShutdown) // true
})
predicates
Source effect/PubSub.ts:7941 lines
export const isShutdown = <A>(self: PubSub<A>): Effect.Effect<boolean> => Effect.sync(() => isShutdownUnsafe(self))