UNPKG

@itwin/presentation-frontend

Version:

Frontend of iModel.js Presentation library

30 lines 1.24 kB
import { PagedResponse, PageOptions } from "@itwin/presentation-common"; import { MultipleValuesRequestOptions } from "./PresentationManager.js"; /** * Properties for streaming the results. * @internal */ export type StreamedResponseGeneratorProps<TItem> = MultipleValuesRequestOptions & { getBatch(page: Required<PageOptions>, requestIdx: number): Promise<PagedResponse<TItem>>; }; /** * This class allows loading values in multiple parallel batches and return them either as an array or an async iterator. * Pages are prefetched in advanced according to the `parallelism` argument. * @internal */ export declare class StreamedResponseGenerator<TPagedResponseItem> { private readonly _props; constructor(_props: StreamedResponseGeneratorProps<TPagedResponseItem>); /** Creates a response with the total item count and an async iterator. */ createAsyncIteratorResponse(): Promise<{ total: number; items: AsyncIterableIterator<TPagedResponseItem>; }>; /** * Fetches the first page. * This function has to be called in order to retrieve the total items count. */ private fetchFirstPage; private getRemainingPages; } //# sourceMappingURL=StreamedResponseGenerator.d.ts.map