MCPcopy Create free account
hub / github.com/Effect-TS/effect / run

Function run

packages/effect/src/unstable/rpc/Utils.ts:41–56  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

39 return Effect.map(f((...args) => write(...args)), (a) => ({
40 ...a,
41 run(f) {
42 return semaphore.withPermits(1)(Effect.gen(function*() {
43 const prev = write
44 write = f
45
46 for (const [args, context] of buffer) {
47 yield* Effect.provideContext(Effect.suspend(() => f(...args)), context)
48 }
49 buffer = []
50
51 return yield* Effect.onExit(Effect.never, () => {
52 write = prev
53 return Effect.void
54 })
55 }))
56 }
57 } as A))
58 })
59

Callers 5

RpcServer.tsFile · 0.70
RpcClient.tsFile · 0.70
onMessageFunction · 0.50
adjustFunction · 0.50
setTimeFunction · 0.50

Calls 5

withPermitsMethod · 0.65
addMethod · 0.65
setMethod · 0.65
getMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected