MCPcopy Create free account
hub / github.com/effect-app/libs / unsubscribe

Function unsubscribe

repos/effect/packages/effect/src/PubSub.ts:1105–1125  ·  view source on GitHub ↗
(self: Subscription<A>)

Source from the content-addressed store, hash-verified

1103 self.replayWindow.close()
1104 self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers)
1105 })
1106 ),
1107 Effect.when(self.shutdownHook.open),
1108 Effect.asVoid
1109 )
1110 })
1111 )
1112
1113/**
1114 * Takes a single message from the subscription. If no messages are available,
1115 * this will suspend until a message becomes available.
1116 *
1117 * **Example** (Taking a message)
1118 *
1119 * ```ts import.meta.vitest
1120 * import { Effect, Fiber, PubSub } from "effect"
1121 *
1122 * const program = Effect.scoped(Effect.gen(function*() {
1123 * const pubsub = yield* PubSub.bounded<string>(10)
1124 *
1125 * const subscription = yield* PubSub.subscribe(pubsub)
1126 *
1127 * // Start a fiber to take a message (will suspend)
1128 * const takeFiber = yield* Effect.forkChild(PubSub.take(subscription))

Callers 2

subscribeFunction · 0.85
dehydrateFunction · 0.85

Calls 8

syncMethod · 0.80
whenMethod · 0.80
setMethod · 0.65
pipeMethod · 0.65
forEachMethod · 0.65
takeAllMethod · 0.65
unsubscribeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…