|
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.0 KB
|
| Line | |
|---|
| 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 | */
|
|---|
| 8 | import { getOrCreatePrecacheController } from './getOrCreatePrecacheController.js';
|
|---|
| 9 | import { generateURLVariations } from './generateURLVariations.js';
|
|---|
| 10 | import '../_version.js';
|
|---|
| 11 | /**
|
|---|
| 12 | * This function will take the request URL and manipulate it based on the
|
|---|
| 13 | * configuration options.
|
|---|
| 14 | *
|
|---|
| 15 | * @param {string} url
|
|---|
| 16 | * @param {Object} options
|
|---|
| 17 | * @return {string} Returns the URL in the cache that matches the request,
|
|---|
| 18 | * if possible.
|
|---|
| 19 | *
|
|---|
| 20 | * @private
|
|---|
| 21 | */
|
|---|
| 22 | export const getCacheKeyForURL = (url, options) => {
|
|---|
| 23 | const precacheController = getOrCreatePrecacheController();
|
|---|
| 24 | const urlsToCacheKeys = precacheController.getURLsToCacheKeys();
|
|---|
| 25 | for (const possibleURL of generateURLVariations(url, options)) {
|
|---|
| 26 | const possibleCacheKey = urlsToCacheKeys.get(possibleURL);
|
|---|
| 27 | if (possibleCacheKey) {
|
|---|
| 28 | return possibleCacheKey;
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.