123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- import { RouteHandlerCallback } from 'workbox-core/types.js';
- import { WorkboxPlugin } from 'workbox-core/types.js';
- import { PrecacheEntry } from './_types.js';
- import './_version.js';
- declare class PrecacheController {
- private readonly _cacheName;
- private readonly _urlsToCacheKeys;
- private readonly _urlsToCacheModes;
- private readonly _cacheKeysToIntegrities;
-
- constructor(cacheName?: string);
- /**
- * This method will add items to the precache list, removing duplicates
- * and ensuring the information is valid.
- *
- * @param {
- * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>
- * } entries Array of entries to precache.
- */
- addToCacheList(entries: Array<PrecacheEntry | string>): void;
- /**
- * Precaches new and updated assets. Call this method from the service worker
- * install event.
- *
- * @param {Object} options
- * @param {Event} [options.event] The install event (if needed).
- * @param {Array<Object>} [options.plugins] Plugins to be used for fetching
- * and caching during install.
- * @return {Promise<module:workbox-precaching.InstallResult>}
- */
- install({ event, plugins }?: {
- event?: ExtendableEvent;
- plugins?: WorkboxPlugin[];
- }): Promise<{
- updatedURLs: string[];
- notUpdatedURLs: string[];
- }>;
-
- activate(): Promise<{
- deletedURLs: string[];
- }>;
-
- _addURLToCache({ cacheKey, url, cacheMode, event, plugins, integrity }: {
- cacheKey: string;
- url: string;
- cacheMode: "reload" | "default" | "no-store" | "no-cache" | "force-cache" | "only-if-cached" | undefined;
- event?: ExtendableEvent;
- plugins?: WorkboxPlugin[];
- integrity?: string;
- }): Promise<void>;
-
- getURLsToCacheKeys(): Map<string, string>;
-
- getCachedURLs(): string[];
-
- getCacheKeyForURL(url: string): string | undefined;
-
- matchPrecache(request: string | Request): Promise<Response | undefined>;
-
- createHandler(fallbackToNetwork?: boolean): RouteHandlerCallback;
-
- createHandlerBoundToURL(url: string, fallbackToNetwork?: boolean): RouteHandlerCallback;
- }
- export { PrecacheController };
|