MCPcopy Create free account
hub / github.com/anomalyco/opencode / subscribe

Function subscribe

packages/tui/src/context/event.ts:12–20  ·  view source on GitHub ↗
(handler: (event: Event, metadata: EventMetadata) => void)

Source from the content-addressed store, hash-verified

10 const sdk = useSDK()
11
12 function subscribe(handler: (event: Event, metadata: EventMetadata) => void) {
13 return sdk.event.on("event", (event) => {
14 if (event.payload.type === "sync") {
15 return
16 }
17
18 handler(event.payload, { directory: event.directory, workspace: event.workspace })
19 })
20 }
21
22 function on<T extends Event["type"]>(
23 type: T,

Callers 1

onFunction · 0.70

Calls 2

onMethod · 0.80
handlerFunction · 0.50

Tested by

no test coverage detected