export type Listener = (payload: T) => void; /** * Minimal typed event emitter backing the puppeteer-style Page event API. * * The optional `onCountChange` hook fires whenever an event's listener count * changes (adds, removes, `once` auto-removal, `removeAllListeners`). Page uses * it to lazily open a subscription on the 0→1 transition and close it on 1→0. * * Listeners are stored in a `Set`, so registering the *same* function twice for * an event is deduped to a single registration (one `emit` call, one `off` to * remove) — unlike Node's `EventEmitter`, which keeps duplicates. This is * intentional: it keeps the 0→1/1→0 count transitions that drive lazy * subscriptions unambiguous. Wrap in distinct closures if you need duplicates. */ export declare class EventEmitter { #private; private readonly onCountChange?; constructor(onCountChange?: ((event: keyof Events, count: number) => void) | undefined); on(event: K, listener: Listener): this; off(event: K, listener: Listener): this; once(event: K, listener: Listener): this; /** Invoke every listener for `event`. Returns whether any listener ran. */ emit(event: K, payload: Events[K]): boolean; listenerCount(event: K): number; removeAllListeners(event?: K): this; } //# sourceMappingURL=emitter.d.ts.map