import { Unsubscribable, Observable } from 'rxjs'; import { EventBus, LegacyEmitter, BusEventHandler, BusEventType, LegacyEventHandler, BusEvent, AppEvent, EventFilterOptions } from './types'; /** * @alpha */ export declare class EventBusSrv implements EventBus, LegacyEmitter { private emitter; private subscribers; constructor(); publish(event: T): void; subscribe(typeFilter: BusEventType, handler: BusEventHandler): Unsubscribable; getStream(eventType: BusEventType): Observable; newScopedBus(key: string, filter?: EventFilterOptions): ScopedEventBus; /** * Legacy functions */ emit(event: AppEvent | string, payload?: T): void; on(event: AppEvent | string, handler: LegacyEventHandler): void; off(event: AppEvent | string, handler: LegacyEventHandler): void; removeAllListeners(): void; } /** * Wraps EventBus and adds a source to help with identifying if a subscriber should react to the event or not. */ declare class ScopedEventBus implements EventBus { path: string[]; private eventBus; filterConfig: EventFilterOptions; constructor(path: string[], eventBus: EventBus, filter?: EventFilterOptions); publish(event: T): void; filter(event: T): boolean; getStream(eventType: BusEventType): Observable; subscribe(typeFilter: BusEventType, handler: BusEventHandler): Unsubscribable; removeAllListeners(): void; /** * Creates a nested event bus structure */ newScopedBus(key: string, filter: EventFilterOptions): EventBus; } export {};