useEventBus
useEventBus():
object
Defined in: useEventBus.ts:131
Hook to create an event bus for plugin communication.
This provides a simple pub/sub mechanism that allows the application to communicate with plugins without tight coupling.
Returns
Section titled “Returns”emit()
Section titled “emit()”emit: <
K>(event,payload) =>void
Emit an event to all subscribers
Type Parameters
Section titled “Type Parameters”K extends keyof SeizenTableEventMap<unknown> | string & object
Parameters
Section titled “Parameters”K
payload
Section titled “payload”K extends keyof SeizenTableEventMap<unknown> ? SeizenTableEventMap<unknown>[K<K>] : unknown
Returns
Section titled “Returns”void
subscribe()
Section titled “subscribe()”subscribe: <
K>(event,callback) => () =>void
Subscribe to an event
Type Parameters
Section titled “Type Parameters”K extends keyof SeizenTableEventMap<unknown> | string & object
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(payload) => void
Returns
Section titled “Returns”Unsubscribe function
():
void
Returns
Section titled “Returns”void
Example
Section titled “Example”// In useSeizenTable:const eventBus = useEventBus();
// Application emits events:eventBus.emit("row-click", row);
// Plugins subscribe via usePluginContext:const { useEvent } = usePluginContext();useEvent("row-click", (row) => { console.log("Row clicked:", row);});