@glandjs/events
Version:
A fast, zero‑dependency event broker and message bus for building scalable, event‑driven applications.
11 lines (10 loc) • 535 B
TypeScript
import { WatchMethod, type EventPayload, type Events, type ShutdownMethod } from '../common';
export declare class EventWatcher<TEvents extends Record<string, any>> implements WatchMethod<TEvents>, ShutdownMethod {
private readonly timeout;
private waitingEvents;
constructor(timeout: number);
watch<K extends Events<TEvents>>(event: K, timeoutMs?: number): Promise<EventPayload<TEvents, K>>;
onEmit<K extends Events<TEvents>>(event: K, payload: TEvents[K]): void;
private cleanupEvent;
shutdown(): void;
}