(
scopeId: string,
commands: Array<{ actionId: string; action: () => void | Promise<void> }>,
)
| 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) ?? [] |
no test coverage detected