source: frontend/node_modules/workbox-strategies/StaleWhileRevalidate.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.4 KB
Line 
1import { Strategy, StrategyOptions } from './Strategy.js';
2import { StrategyHandler } from './StrategyHandler.js';
3import './_version.js';
4/**
5 * An implementation of a
6 * [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate)
7 * request strategy.
8 *
9 * Resources are requested from both the cache and the network in parallel.
10 * The strategy will respond with the cached version if available, otherwise
11 * wait for the network response. The cache is updated with the network response
12 * with each successful request.
13 *
14 * By default, this strategy will cache responses with a 200 status code as
15 * well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
16 * Opaque responses are cross-origin requests where the response doesn't
17 * support [CORS](https://enable-cors.org/).
18 *
19 * If the network request fails, and there is no cache match, this will throw
20 * a `WorkboxError` exception.
21 *
22 * @extends workbox-strategies.Strategy
23 * @memberof workbox-strategies
24 */
25declare class StaleWhileRevalidate extends Strategy {
26 /**
27 * @param {Object} [options]
28 * @param {string} [options.cacheName] Cache name to store and retrieve
29 * requests. Defaults to cache names provided by
30 * {@link workbox-core.cacheNames}.
31 * @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
32 * to use in conjunction with this caching strategy.
33 * @param {Object} [options.fetchOptions] Values passed along to the
34 * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)
35 * of [non-navigation](https://github.com/GoogleChrome/workbox/issues/1796)
36 * `fetch()` requests made by this strategy.
37 * @param {Object} [options.matchOptions] [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
38 */
39 constructor(options?: StrategyOptions);
40 /**
41 * @private
42 * @param {Request|string} request A request to run this strategy for.
43 * @param {workbox-strategies.StrategyHandler} handler The event that
44 * triggered the request.
45 * @return {Promise<Response>}
46 */
47 _handle(request: Request, handler: StrategyHandler): Promise<Response>;
48}
49export { StaleWhileRevalidate };
Note: See TracBrowser for help on using the repository browser.