1 | this.workbox = this.workbox || {};
|
2 | this.workbox.navigationPreload = (function (exports,logger_mjs) {
|
3 | ;
|
4 |
|
5 | try {
|
6 | self.workbox.v['workbox:navigation-preload:3.5.0'] = 1;
|
7 | } catch (e) {} // eslint-disable-line
|
8 |
|
9 | /*
|
10 | Copyright 2018 Google Inc.
|
11 |
|
12 | Licensed under the Apache License, Version 2.0 (the "License");
|
13 | you may not use this file except in compliance with the License.
|
14 | You may obtain a copy of the License at
|
15 |
|
16 | https://www.apache.org/licenses/LICENSE-2.0
|
17 |
|
18 | Unless required by applicable law or agreed to in writing, software
|
19 | distributed under the License is distributed on an "AS IS" BASIS,
|
20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21 | See the License for the specific language governing permissions and
|
22 | limitations under the License.
|
23 | */
|
24 |
|
25 | /**
|
26 | * @return {boolean} Whether or not the current browser supports enabling
|
27 | * navigation preload.
|
28 | *
|
29 | * @memberof workbox.navigationPreload
|
30 | */
|
31 | function isSupported() {
|
32 | return Boolean(self.registration && self.registration.navigationPreload);
|
33 | }
|
34 |
|
35 | /*
|
36 | Copyright 2017 Google Inc.
|
37 |
|
38 | Licensed under the Apache License, Version 2.0 (the "License");
|
39 | you may not use this file except in compliance with the License.
|
40 | You may obtain a copy of the License at
|
41 |
|
42 | https://www.apache.org/licenses/LICENSE-2.0
|
43 |
|
44 | Unless required by applicable law or agreed to in writing, software
|
45 | distributed under the License is distributed on an "AS IS" BASIS,
|
46 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
47 | See the License for the specific language governing permissions and
|
48 | limitations under the License.
|
49 | */
|
50 |
|
51 | /**
|
52 | * If the browser supports Navigation Preload, then this will enable it.
|
53 | *
|
54 | * @param {string} [headerValue] Optionally, allows developers to
|
55 | * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)
|
56 | * the value of the `Service-Worker-Navigation-Preload` header which will be
|
57 | * sent to the server when making the navigation request.
|
58 | *
|
59 | * @memberof workbox.navigationPreload
|
60 | */
|
61 | function enable(headerValue) {
|
62 | if (isSupported()) {
|
63 | self.addEventListener('activate', event => {
|
64 | event.waitUntil(self.registration.navigationPreload.enable().then(() => {
|
65 | // Defaults to Service-Worker-Navigation-Preload: true if not set.
|
66 | if (headerValue) {
|
67 | self.registration.navigationPreload.setHeaderValue(headerValue);
|
68 | }
|
69 |
|
70 | {
|
71 | logger_mjs.logger.log(`Navigation preload is enabled.`);
|
72 | }
|
73 | }));
|
74 | });
|
75 | } else {
|
76 | {
|
77 | logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
|
78 | }
|
79 | }
|
80 | }
|
81 |
|
82 | /*
|
83 | Copyright 2017 Google Inc.
|
84 |
|
85 | Licensed under the Apache License, Version 2.0 (the "License");
|
86 | you may not use this file except in compliance with the License.
|
87 | You may obtain a copy of the License at
|
88 |
|
89 | https://www.apache.org/licenses/LICENSE-2.0
|
90 |
|
91 | Unless required by applicable law or agreed to in writing, software
|
92 | distributed under the License is distributed on an "AS IS" BASIS,
|
93 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
94 | See the License for the specific language governing permissions and
|
95 | limitations under the License.
|
96 | */
|
97 |
|
98 | /*
|
99 | Copyright 2017 Google Inc.
|
100 |
|
101 | Licensed under the Apache License, Version 2.0 (the "License");
|
102 | you may not use this file except in compliance with the License.
|
103 | You may obtain a copy of the License at
|
104 |
|
105 | https://www.apache.org/licenses/LICENSE-2.0
|
106 |
|
107 | Unless required by applicable law or agreed to in writing, software
|
108 | distributed under the License is distributed on an "AS IS" BASIS,
|
109 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
110 | See the License for the specific language governing permissions and
|
111 | limitations under the License.
|
112 | */
|
113 |
|
114 | exports.enable = enable;
|
115 | exports.isSupported = isSupported;
|
116 |
|
117 | return exports;
|
118 |
|
119 | }({},workbox.core._private));
|
120 |
|
121 | //# sourceMappingURL=workbox-navigation-preload.dev.js.map
|