source: frontend/node_modules/workbox-precaching/addRoute.js

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

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 Copyright 2019 Google LLC
3 Use of this source code is governed by an MIT-style
4 license that can be found in the LICENSE file or at
5 https://opensource.org/licenses/MIT.
6*/
7import { registerRoute } from 'workbox-routing/registerRoute.js';
8import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController.js';
9import { PrecacheRoute } from './PrecacheRoute.js';
10import './_version.js';
11/**
12 * Add a `fetch` listener to the service worker that will
13 * respond to
14 * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}
15 * with precached assets.
16 *
17 * Requests for assets that aren't precached, the `FetchEvent` will not be
18 * responded to, allowing the event to fall through to other `fetch` event
19 * listeners.
20 *
21 * @param {Object} [options] See the {@link workbox-precaching.PrecacheRoute}
22 * options.
23 *
24 * @memberof workbox-precaching
25 */
26function addRoute(options) {
27 const precacheController = getOrCreatePrecacheController();
28 const precacheRoute = new PrecacheRoute(precacheController, options);
29 registerRoute(precacheRoute);
30}
31export { addRoute };
Note: See TracBrowser for help on using the repository browser.