UNPKG

1.16 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 * Takes in a URL, and returns the corresponding URL that could be used to
12 * lookup the entry in the precache.
13 *
14 * If a relative URL is provided, the location of the service worker file will
15 * be used as the base.
16 *
17 * For precached entries without revision information, the cache key will be the
18 * same as the original URL.
19 *
20 * For precached entries with revision information, the cache key will be the
21 * original URL with the addition of a query parameter used for keeping track of
22 * the revision info.
23 *
24 * @param {string} url The URL whose cache key to look up.
25 * @return {string} The cache key that corresponds to that URL.
26 *
27 * @memberof workbox-precaching
28 */
29function getCacheKeyForURL(url) {
30 const precacheController = getOrCreatePrecacheController();
31 return precacheController.getCacheKeyForURL(url);
32}
33export { getCacheKeyForURL };