MCPcopy Create free account
hub / github.com/arctic-cli/interface / once

Function once

packages/arctic/src/bus/index.ts:74–84  ·  view source on GitHub ↗
(
    def: Definition,
    callback: (event: {
      type: Definition["type"]
      properties: z.infer<Definition["properties"]>
    }) => "done" | undefined,
  )

Source from the content-addressed store, hash-verified

72 }
73
74 export function once<Definition extends BusEvent.Definition>(
75 def: Definition,
76 callback: (event: {
77 type: Definition["type"]
78 properties: z.infer<Definition["properties"]>
79 }) => "done" | undefined,
80 ) {
81 const unsub = subscribe(def, (event) => {
82 if (callback(event)) unsub()
83 })
84 }
85
86 export function subscribeAll(callback: (event: any) => void) {
87 return raw("*", callback)

Callers

nothing calls this directly

Calls 2

subscribeFunction · 0.70
callbackFunction · 0.50

Tested by

no test coverage detected