urbi-exhibitions
Version:
33 lines (32 loc) • 982 B
TypeScript
import { GetRouteParams } from '../api/index';
import { Route } from '../types';
import { RouteKey } from '../utils/getRouteKey';
/**
* Create store for routes
*/
export declare const routesCache: import('idb-keyval').UseStore;
/**
* Create string key for IndexedDB
*/
export declare const getRouteStringKey: (key: RouteKey) => string;
export type PrefetchRoutesParams = {
routes: GetRouteParams[];
chunkSize?: number;
maxConcurrent?: number;
maxRequestsPerMinute?: number;
maxRequestsPerSecond?: number;
getRoute: (params: GetRouteParams) => Route;
onProgress?: (completed: number, total: number) => void;
};
/**
* Fetch routes and save them to cache
*/
export declare const prefetchRoutes: (params: PrefetchRoutesParams) => Promise<void>;
/**
* Clear routes cache
*/
export declare const clearRoutesCache: () => Promise<void>;
/**
* Get route cache by key
*/
export declare const getRouteCache: (key: RouteKey) => Promise<Route | undefined>;