MCPcopy Index your code
hub / github.com/anomalyco/opencode / bind

Function bind

packages/opencode/src/effect/bridge.ts:27–38  ·  view source on GitHub ↗
(fn: (...args: Args) => Result)

Source from the content-addressed store, hash-verified

25}
26
27export const bind = <Args extends readonly unknown[], Result>(fn: (...args: Args) => Result) => {
28 const captured = captureSync()
29 return (...args: Args) =>
30 restoreWorkspace(captured.workspace, () =>
31 Effect.runSync(
32 attachWith(
33 Effect.sync(() => fn(...args)),
34 captured,
35 ),
36 ),
37 )
38}
39
40/**
41 * Bridge from Effect into a Promise-returning JS callback while preserving

Callers

nothing calls this directly

Calls 5

attachWithFunction · 0.90
captureSyncFunction · 0.85
restoreWorkspaceFunction · 0.85
syncMethod · 0.80
fnFunction · 0.50

Tested by

no test coverage detected