|
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 2020 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 '../_version.js';
|
|---|
| 9 | /**
|
|---|
| 10 | * A plugin, designed to be used with PrecacheController, to translate URLs into
|
|---|
| 11 | * the corresponding cache key, based on the current revision info.
|
|---|
| 12 | *
|
|---|
| 13 | * @private
|
|---|
| 14 | */
|
|---|
| 15 | class PrecacheCacheKeyPlugin {
|
|---|
| 16 | constructor({ precacheController }) {
|
|---|
| 17 | this.cacheKeyWillBeUsed = async ({ request, params, }) => {
|
|---|
| 18 | // Params is type any, can't change right now.
|
|---|
| 19 | /* eslint-disable */
|
|---|
| 20 | const cacheKey = (params === null || params === void 0 ? void 0 : params.cacheKey) ||
|
|---|
| 21 | this._precacheController.getCacheKeyForURL(request.url);
|
|---|
| 22 | /* eslint-enable */
|
|---|
| 23 | return cacheKey
|
|---|
| 24 | ? new Request(cacheKey, { headers: request.headers })
|
|---|
| 25 | : request;
|
|---|
| 26 | };
|
|---|
| 27 | this._precacheController = precacheController;
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 | export { PrecacheCacheKeyPlugin };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.