1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js';
- import './_version.js';
- interface CacheFirstOptions {
- cacheName?: string;
- plugins?: WorkboxPlugin[];
- fetchOptions?: RequestInit;
- matchOptions?: CacheQueryOptions;
- }
- declare class CacheFirst implements RouteHandlerObject {
- private readonly _cacheName;
- private readonly _plugins;
- private readonly _fetchOptions?;
- private readonly _matchOptions?;
-
- constructor(options?: CacheFirstOptions);
- /**
- * This method will perform a request strategy and follows an API that
- * will work with the
- * [Workbox Router]{@link module:workbox-routing.Router}.
- *
- * @param {Object} options
- * @param {Request|string} options.request A request to run this strategy for.
- * @param {Event} [options.event] The event that triggered the request.
- * @return {Promise<Response>}
- */
- handle({ event, request }: RouteHandlerCallbackOptions): Promise<Response>;
- /**
- * Handles the network and cache part of CacheFirst.
- *
- * @param {Request} request
- * @param {Event} [event]
- * @return {Promise<Response>}
- *
- * @private
- */
- _getFromNetwork(request: Request, event?: ExtendableEvent): Promise<any>;
- }
- export { CacheFirst };
|