@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 22 lines 749 Bytes
Raw
1 import * as Effect from "effect/Effect"
2 import * as PubSub from "effect/PubSub"
3
4 const program = Effect.gen(function*() {
5 const pubsub = yield* PubSub.unbounded<number>()
6
7 yield* Effect.gen(function*() {
8 const subscription = yield* PubSub.subscribe(pubsub)
9 while (true) {
10 const element = yield* PubSub.take(subscription)
11 console.log(element)
12 }
13 }).pipe(Effect.forkScoped({ startImmediately: true }))
14
15 yield* PubSub.publishAll(pubsub, [1, 2])
16 yield* PubSub.publishAll(pubsub, [3, 4]).pipe(Effect.delay("100 millis"), Effect.forkScoped)
17 yield* PubSub.publishAll(pubsub, [5, 6, 7, 8]).pipe(Effect.delay("200 millis"), Effect.forkScoped)
18
19 yield* Effect.sleep("500 millis")
20 })
21
22 Effect.runFork(Effect.scoped(program))