UNPKG

speech-provider

Version:

A unified interface for browser speech synthesis and Eleven Labs voices

39 lines 1.26 kB
interface CachedFetchOptions extends RequestInit { additionalHeaders?: Record<string, string>; cacheOptions?: { maxAge?: number | null; skipCache?: boolean; }; } /** * Enhanced fetch function that supports client-side response caching using the Cache API. * Responses are cached based on the URL and request options. * * @param url The URL to fetch * @param options Fetch options including cache configuration * @returns A fetch Response object * * @example * ```typescript * // Basic usage with default 1-hour cache * const response = await cachedFetch('https://api.example.com/data'); * * // Custom cache duration (1 day) * const response = await cachedFetch('https://api.example.com/data', { * cacheOptions: { maxAge: 86400 } * }); * * // Disable caching (preferred approach) * const response = await cachedFetch('https://api.example.com/data', { * cacheOptions: { maxAge: null } * }); * * // Alternative way to disable caching * const response = await cachedFetch('https://api.example.com/data', { * cacheOptions: { maxAge: 0 } * }); * ``` */ export declare function cachedFetch(url: string, options?: CachedFetchOptions): Promise<Response>; export {}; //# sourceMappingURL=cachedFetch.d.ts.map