import { EventType } from "./EventType"; import { IEvent } from "../api/IEvent"; export default class EventStream { static readonly SYSTEM_EVENT_TYPE_PREFIX = "GAIA::"; /** * Emits an event of the given type with the given data. All callbacks that are listening to the particular * event type will be notified. * * @param eventType * @param args */ static emit(eventType: string, ...args: any[]): void; /** * Emits an event of the given type with the given data. All callbacks that are listening to the particular * event type will be notified. * * @param event */ static emitEvent(event: IEvent): void; /** * Return an array of listeners that are currently registered for the given event type. * * @param eventType */ static listeners(eventType: string): ((args: any[]) => void)[]; /** * Removes all of the registered listeners. eventType is optional, if provided only listeners for that * event type are removed. * * @param eventType */ static removeAllListeners(eventType?: string): void; /** * Register a specific callback to be called on a particular event. A token is returned that can be used * to remove the listener. */ static addListener(eventType: EventType | string, listener: (...args: any[]) => void): { remove: () => void; }; private static theListeners; }