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

Function setup

packages/platform-browser/src/internal/worker.ts:9–20  ·  view source on GitHub ↗
({ scope, worker })

Source from the content-addressed store, hash-verified

7
8const platformWorkerImpl = Worker.makePlatform<globalThis.SharedWorker | globalThis.Worker | MessagePort>()({
9 setup({ scope, worker }) {
10 const port = "port" in worker ? worker.port : worker
11 return Effect.as(
12 Scope.addFinalizer(
13 scope,
14 Effect.sync(() => {
15 port.postMessage([1])
16 })
17 ),
18 port
19 )
20 },
21 listen({ deferred, emit, port, scope }) {
22 function onMessage(event: MessageEvent) {
23 emit(event.data)

Callers

nothing calls this directly

Calls 2

syncMethod · 0.80
addFinalizerMethod · 0.65

Tested by

no test coverage detected