(self: Subscription<A>)
| 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)) |
no test coverage detected
searching dependent graphs…