UNPKG

@vegajs/event-bus

Version:

A flexible and typed Event Bus implementation for TypeScript and JavaScript projects. It facilitates communication between components and modules without tight coupling.

6 lines (5 loc) 301 B
export type EventBus<EventMap> = { on<K extends keyof EventMap>(eventName: K, handler: (event: EventMap[K]) => void): void; off<K extends keyof EventMap>(eventName: K, handler: (event: EventMap[K]) => void): void; emit<K extends keyof EventMap>(eventName: K, event: EventMap[K]): void; };