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.6.3'] = 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 disable it.
|
53 | *
|
54 | * @memberof workbox.navigationPreload
|
55 | */
|
56 | function disable() {
|
57 | if (isSupported()) {
|
58 | self.addEventListener('activate', event => {
|
59 | event.waitUntil(self.registration.navigationPreload.disable().then(() => {
|
60 | {
|
61 | logger_mjs.logger.log(`Navigation preload is disabled.`);
|
62 | }
|
63 | }));
|
64 | });
|
65 | } else {
|
66 | {
|
67 | logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
|
68 | }
|
69 | }
|
70 | }
|
71 |
|
72 | /*
|
73 | Copyright 2017 Google Inc.
|
74 |
|
75 | Licensed under the Apache License, Version 2.0 (the "License");
|
76 | you may not use this file except in compliance with the License.
|
77 | You may obtain a copy of the License at
|
78 |
|
79 | https://www.apache.org/licenses/LICENSE-2.0
|
80 |
|
81 | Unless required by applicable law or agreed to in writing, software
|
82 | distributed under the License is distributed on an "AS IS" BASIS,
|
83 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
84 | See the License for the specific language governing permissions and
|
85 | limitations under the License.
|
86 | */
|
87 |
|
88 | /**
|
89 | * If the browser supports Navigation Preload, then this will enable it.
|
90 | *
|
91 | * @param {string} [headerValue] Optionally, allows developers to
|
92 | * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)
|
93 | * the value of the `Service-Worker-Navigation-Preload` header which will be
|
94 | * sent to the server when making the navigation request.
|
95 | *
|
96 | * @memberof workbox.navigationPreload
|
97 | */
|
98 | function enable(headerValue) {
|
99 | if (isSupported()) {
|
100 | self.addEventListener('activate', event => {
|
101 | event.waitUntil(self.registration.navigationPreload.enable().then(() => {
|
102 | // Defaults to Service-Worker-Navigation-Preload: true if not set.
|
103 | if (headerValue) {
|
104 | self.registration.navigationPreload.setHeaderValue(headerValue);
|
105 | }
|
106 |
|
107 | {
|
108 | logger_mjs.logger.log(`Navigation preload is enabled.`);
|
109 | }
|
110 | }));
|
111 | });
|
112 | } else {
|
113 | {
|
114 | logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
|
115 | }
|
116 | }
|
117 | }
|
118 |
|
119 | /*
|
120 | Copyright 2017 Google Inc.
|
121 |
|
122 | Licensed under the Apache License, Version 2.0 (the "License");
|
123 | you may not use this file except in compliance with the License.
|
124 | You may obtain a copy of the License at
|
125 |
|
126 | https://www.apache.org/licenses/LICENSE-2.0
|
127 |
|
128 | Unless required by applicable law or agreed to in writing, software
|
129 | distributed under the License is distributed on an "AS IS" BASIS,
|
130 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
131 | See the License for the specific language governing permissions and
|
132 | limitations under the License.
|
133 | */
|
134 |
|
135 | /*
|
136 | Copyright 2017 Google Inc.
|
137 |
|
138 | Licensed under the Apache License, Version 2.0 (the "License");
|
139 | you may not use this file except in compliance with the License.
|
140 | You may obtain a copy of the License at
|
141 |
|
142 | https://www.apache.org/licenses/LICENSE-2.0
|
143 |
|
144 | Unless required by applicable law or agreed to in writing, software
|
145 | distributed under the License is distributed on an "AS IS" BASIS,
|
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
147 | See the License for the specific language governing permissions and
|
148 | limitations under the License.
|
149 | */
|
150 |
|
151 | exports.disable = disable;
|
152 | exports.enable = enable;
|
153 | exports.isSupported = isSupported;
|
154 |
|
155 | return exports;
|
156 |
|
157 | }({},workbox.core._private));
|
158 |
|
159 | //# sourceMappingURL=workbox-navigation-preload.dev.js.map
|