/** * Type-safe event emitter — engine-neutral. * * The emitter itself never knew anything about 3D; it only lived in `stage` * because that is where the app lived. Anything that wants to announce state * changes (an app, a board, a manager) can now use it without pulling in the * renderer. */ export type Listener = (data: T) => void; /** * Events every app announces, whatever it renders. * * Engines extend this with their own map; `history-change` is here because * `CommandManager` — also core's — emits it. */ export interface AppEventMap { "history-change": { canUndo: boolean; canRedo: boolean; }; } /** * Instantiate with an event map and every `on` / `off` / `emit` is checked * against it at compile time. */ export declare class EventEmitter> { private listeners; /** Subscribe; the returned function unsubscribes. */ on(event: K, listener: Listener): () => void; off(event: K, listener: Listener): void; /** Iterates a copy, so a listener may unsubscribe during dispatch. */ emit(event: K, data: TMap[K]): void; clear(): void; }