|
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:
1.2 KB
|
| Rev | Line | |
|---|
| [9af201e] | 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 | */
|
|---|
| 7 |
|
|---|
| 8 | import {registerRoute} from 'workbox-routing/registerRoute.js';
|
|---|
| 9 |
|
|---|
| 10 | import {getOrCreatePrecacheController} from './utils/getOrCreatePrecacheController.js';
|
|---|
| 11 | import {PrecacheRoute} from './PrecacheRoute.js';
|
|---|
| 12 | import {PrecacheRouteOptions} from './_types.js';
|
|---|
| 13 |
|
|---|
| 14 | import './_version.js';
|
|---|
| 15 |
|
|---|
| 16 | /**
|
|---|
| 17 | * Add a `fetch` listener to the service worker that will
|
|---|
| 18 | * respond to
|
|---|
| 19 | * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}
|
|---|
| 20 | * with precached assets.
|
|---|
| 21 | *
|
|---|
| 22 | * Requests for assets that aren't precached, the `FetchEvent` will not be
|
|---|
| 23 | * responded to, allowing the event to fall through to other `fetch` event
|
|---|
| 24 | * listeners.
|
|---|
| 25 | *
|
|---|
| 26 | * @param {Object} [options] See the {@link workbox-precaching.PrecacheRoute}
|
|---|
| 27 | * options.
|
|---|
| 28 | *
|
|---|
| 29 | * @memberof workbox-precaching
|
|---|
| 30 | */
|
|---|
| 31 | function addRoute(options?: PrecacheRouteOptions): void {
|
|---|
| 32 | const precacheController = getOrCreatePrecacheController();
|
|---|
| 33 |
|
|---|
| 34 | const precacheRoute = new PrecacheRoute(precacheController, options);
|
|---|
| 35 | registerRoute(precacheRoute);
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | export {addRoute};
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.