UNPKG

1.12 kBJavaScriptView Raw
1/*
2 Copyright 2019 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController.js';
9import './_version.js';
10/**
11 * Adds items to the precache list, removing any duplicates and
12 * stores the files in the
13 * {@link workbox-core.cacheNames|"precache cache"} when the service
14 * worker installs.
15 *
16 * This method can be called multiple times.
17 *
18 * Please note: This method **will not** serve any of the cached files for you.
19 * It only precaches files. To respond to a network request you call
20 * {@link workbox-precaching.addRoute}.
21 *
22 * If you have a single array of files to precache, you can just call
23 * {@link workbox-precaching.precacheAndRoute}.
24 *
25 * @param {Array<Object|string>} [entries=[]] Array of entries to precache.
26 *
27 * @memberof workbox-precaching
28 */
29function precache(entries) {
30 const precacheController = getOrCreatePrecacheController();
31 precacheController.precache(entries);
32}
33export { precache };