import { EventMap } from './types'; export type EventHandler = (payload: T) => void; export type Unsubscribe = () => void; export interface EventBus> { /** Emit an event with payload */ emit(event: K, payload: Events[K]): void; /** Subscribe to an event */ on(event: K, handler: EventHandler): Unsubscribe; /** Subscribe to an event, automatically unsubscribe after first emission */ once(event: K, handler: EventHandler): Unsubscribe; /** Remove all listeners for an event, or all listeners if no event specified */ off(event?: K): void; /** Destroy the event bus */ destroy(): void; } /** * Create a typed event bus */ export declare function createEventBus = EventMap>(): EventBus; /** * Create a namespaced event bus that prefixes all events */ export declare function createNamespacedEventBus>(parentBus: EventBus>, namespace: string): EventBus; //# sourceMappingURL=event-bus.d.ts.map