MCPcopy
hub / github.com/npmx-dev/npmx.dev / registerContextCommandActions

Function registerContextCommandActions

app/composables/useCommandPalette.ts:127–142  ·  view source on GitHub ↗
(
    scopeId: string,
    commands: Array<{ actionId: string; action: () => void | Promise<void> }>,
  )

Source from the content-addressed store, hash-verified

125 }
126
127 function registerContextCommandActions(
128 scopeId: string,
129 commands: Array<{ actionId: string; action: () => void | Promise<void> }>,
130 ) {
131 const previousActionIds = actionIdsByScopeId.get(scopeId) ?? []
132 previousActionIds.forEach(actionId => {
133 actionRegistry.delete(actionId)
134 })
135
136 const nextActionIds: string[] = []
137 commands.forEach(command => {
138 actionRegistry.set(command.actionId, command.action)
139 nextActionIds.push(command.actionId)
140 })
141 actionIdsByScopeId.set(scopeId, nextActionIds)
142 }
143
144 function clearContextCommandActions(scopeId: string) {
145 const actionIds = actionIdsByScopeId.get(scopeId) ?? []

Callers 1

Calls 3

getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected