UNPKG

@algolia/autocomplete-core

Version:

Core primitives for building autocomplete experiences.

28 lines (27 loc) 937 B
import { CancelablePromise } from '.'; export declare type CancelablePromiseList<TValue> = { /** * Add a cancelable promise to the list. * * @param cancelablePromise The cancelable promise to add. */ add(cancelablePromise: CancelablePromise<TValue>): CancelablePromise<TValue>; /** * Cancel all pending promises. * * Requests aren't actually stopped. All pending promises will settle, but * attached handlers won't run. */ cancelAll(): void; /** * Whether there are pending promises in the list. */ isEmpty(): boolean; /** * Waits for all pending promises to be resolved. * * @param timeout Maximum amount of time allowed to wait for pending promises. Returns early if this time is reached. */ wait(timeout?: number): Promise<void>; }; export declare function createCancelablePromiseList<TValue>(): CancelablePromiseList<TValue>;