Files
Reims-Go/frontend/src/lib/pluginViewEvents.ts
T
NwflowerandClaude Opus 5.5 565577589a refactor: give each VM action one window binding
Every VM action had two bindings: one by name and one by driver and name.
The window used only the second, so the first is gone and the WithDriver
suffix with it. Unused bindings and frontend exports are removed too.

Tests now reject bindings the window never calls, stale generated
bindings and unused frontend exports. TypeScript rejects unused locals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 21:16:28 -07:00

20 lines
634 B
TypeScript

type PluginHostEvent = 'vm.stateChanged' | 'task.updated'
type PluginHostEventListener = (event: PluginHostEvent, data: unknown) => void
const listeners = new Set<PluginHostEventListener>()
export function publishPluginHostEvent(event: PluginHostEvent, data: unknown): void {
for (const listener of [...listeners]) {
try {
listener(event, data)
} catch (error) {
console.warn('[plugin] could not deliver host event:', event, error)
}
}
}
export function subscribePluginHostEvents(listener: PluginHostEventListener): () => void {
listeners.add(listener)
return () => { listeners.delete(listener) }
}