(self: PubSub<A>)
| 1075 | * @since 2.0.0 |
| 1076 | */ |
| 1077 | export const subscribe = <A>(self: PubSub<A>): Effect.Effect<Subscription<A>, never, Scope.Scope> => |
| 1078 | Effect.uninterruptible( |
| 1079 | Effect.contextWith((services) => { |
| 1080 | const localScope = Context.get(services, Scope.Scope) |
| 1081 | const scope = Scope.forkUnsafe(self.scope) |
| 1082 | const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy) |
| 1083 | return Scope.addFinalizer(scope, unsubscribe(subscription)).pipe( |
| 1084 | Effect.andThen(Scope.addFinalizerExit(localScope, (exit) => Scope.close(scope, exit))), |
| 1085 | Effect.as(subscription) |
| 1086 | ) |
| 1087 | }) |
| 1088 | ) |
| 1089 | |
| 1090 | const unsubscribe = <A>(self: Subscription<A>): Effect.Effect<void> => |
| 1091 | Effect.uninterruptible( |
nothing calls this directly
no test coverage detected