/** * react-fetch v1.49.0 * * Copyright (c) resourge. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import { type PaginationMetadata } from '../types'; import { type PaginationSearchParamsType } from '../types/ParamsType'; export type PreloadConfig = false | { maxPerPage?: number; next?: boolean; previous?: boolean; /** * @default 60000 miliseconds (1minute) */ timeout?: number; }; export type PreloadMethodResult = { data: Data; totalItems?: number; }; export type PreloadProps = Record> = { deps: readonly any[]; initialPage: number; method: (metadata: PaginationMetadata) => Promise>; preload?: PreloadConfig; }; export type PreloadRef = Record; export declare const usePreload: = Record>({ deps, initialPage, method, preload }: PreloadProps) => { getMethod: (metadata: PaginationMetadata) => Promise>; getRestoreMethod: (metadata: PaginationMetadata, pagination: PaginationSearchParamsType, onData?: (index: number, data: Data) => void) => Promise<{ totalItems: number | undefined; }>; preloadRef: import("react").RefObject>; willPreload: (page: number) => boolean; };