/** * Throttle a function to be called at most once every "wait" milliseconds, * on the trailing edge. * * Roughly equivalent to lodash/throttle with {leading: false, trailing: true} */ export declare function throttleTrailing(func: () => void, wait: number): () => void; export interface AsyncNotifier { /** * @param signal Also resolve the promise once this signal completes. * @returns A promise that resolves once {@link notify} is called after this promise was last resolved. */ waitForNotification(signal: AbortSignal): Promise; /** * Notifies a pending listener, or makes the next {@link waitForNotification} complete immediately if no listener * is currently active. */ notify(): void; } export declare function asyncNotifier(): AsyncNotifier; export interface QueueOptions { eventDelivered?: () => void; } export declare class EventQueue { private readonly options; private waitingConsumer; private readonly outstandingEvents; constructor(options?: QueueOptions); /** * The amount of buffered events not yet dispatched to listeners. */ get countOutstandingEvents(): number; private notifyInner; notify(value: T): void; notifyError(error: unknown): void; waitForEvent(signal: AbortSignal): Promise; /** * Creates an async iterable backed by event queues. * * @param run A function invoked for every new listener. It receives a queue backing the async iterator. * @param abort An additional abort signal. The `run` callback will also be aborted when `AsyncIterator.return` is * called. * @returns An object conforming to the async iterable protocol. */ static queueBasedAsyncIterable(run: (queue: EventQueue, abort: AbortSignal) => void, abort?: AbortSignal): AsyncIterable; }