export interface EventHandle { release(): void; } type EventClass = { new (...args: any[]): T; }; export declare class ServerEvents { /** * Registers a server event handler function * @param event_class the class for the type of event to register for * @param handler the handler function to be triggered when the event occurs * @returns a handle that can be released */ static register(event_class: EventClass, handler: (event: T) => void): EventHandle | null; /** * Waits for a server event to occur and returns a promise that resolves with the event. * @param event_class the class for the type of event to wait for * @param matcher the matcher function to determine if the event should be resolved * @param timeout the timeout in milliseconds * @returns a promise that resolves with the event */ static waitFor(event_class: EventClass, matcher?: (event: T) => boolean, timeout?: number): Promise; /** * Waits for one of several server events and resolves with the first matching event. * @param event_classes the classes for event types to wait for * @param matcher the matcher function to determine if an event should be resolved * @param timeout the timeout in milliseconds * @returns a promise that resolves with the first matching event */ static waitFor(event_classes: Array>, matcher?: (event: T) => boolean, timeout?: number): Promise; /** * Streams server events asynchronously. * @param event_class the class for the type of event to stream * @returns an async iterable that emits the events */ static stream(event_class: EventClass): AsyncIterable; } export {};