0.1.11 #14
17
packages/reffuse/src/tests.ts
Normal file
17
packages/reffuse/src/tests.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { Effect, Exit, PubSub, Scope, Stream } from "effect"
|
||||||
|
|
||||||
|
|
||||||
|
await Effect.gen(function*() {
|
||||||
|
const scope = yield* Scope.make()
|
||||||
|
|
||||||
|
const pubsub = yield* PubSub.unbounded<string>()
|
||||||
|
console.log(yield* PubSub.isShutdown(pubsub))
|
||||||
|
const stream = yield* Stream.fromPubSub(pubsub, { scoped: true, shutdown: true }).pipe(
|
||||||
|
Effect.provideService(Scope.Scope, scope)
|
||||||
|
)
|
||||||
|
|
||||||
|
yield* Scope.close(scope, Exit.void)
|
||||||
|
console.log(yield* PubSub.isShutdown(pubsub))
|
||||||
|
}).pipe(
|
||||||
|
Effect.runPromise,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user