react-img-toolkit
Version:
A lightweight React library for optimizing image loading through preloading, lazy loading, and caching capabilities
15 lines (14 loc) • 454 B
TypeScript
type MediaType = 'image' | 'video';
interface UseMediaPreloaderOptions {
onSuccess?: () => void;
onError?: (error: Error) => void;
mediaType?: MediaType | ((url: string) => MediaType);
}
interface UseMediaPreloaderResult {
urls: string[];
count: number;
loaded: boolean;
error: Error | null;
}
export declare const useImagePreloader: (urls: string[], options?: UseMediaPreloaderOptions) => UseMediaPreloaderResult;
export {};