MCPcopy Index your code
hub / github.com/Effect-TS/effect / onMessage

Function onMessage

packages/platform-bun/src/internal/workerRunner.ts:39–52  ·  view source on GitHub ↗
(event: MessageEvent)

Source from the content-addressed store, hash-verified

37 }
38
39 function onMessage(event: MessageEvent) {
40 const message = (event as MessageEvent).data as Runner.BackingRunner.Message<any>
41 if (message[0] === 0) {
42 const result = handler(0, message[1])
43 if (Effect.isEffect(result)) {
44 const fiber = runFork(result)
45 fiber.addObserver(onExit)
46 FiberSet.unsafeAdd(fiberSet, fiber)
47 }
48 } else {
49 port.close()
50 Deferred.unsafeDone(closeLatch, Exit.void)
51 }
52 }
53 function onMessageError(error: MessageEvent) {
54 Deferred.unsafeDone(
55 closeLatch,

Callers

nothing calls this directly

Calls 5

unsafeDoneMethod · 0.80
handlerFunction · 0.70
addObserverMethod · 0.65
closeMethod · 0.65
runForkFunction · 0.50

Tested by

no test coverage detected