sw.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <<<<<<< HEAD
  2. /**
  3. * Copyright 2018 Google Inc. All Rights Reserved.
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. * See the License for the specific language governing permissions and
  12. * limitations under the License.
  13. */
  14. // If the loader is already loaded, just stop.
  15. if (!self.define) {
  16. const registry = {};
  17. // Used for `eval` and `importScripts` where we can't get script URL by other means.
  18. // In both cases, it's safe to use a global var because those functions are synchronous.
  19. let nextDefineUri;
  20. const singleRequire = (uri, parentUri) => {
  21. uri = new URL(uri + '.js', parentUri).href;
  22. return (
  23. registry[uri] ||
  24. new Promise(resolve => {
  25. if ('document' in self) {
  26. const script = document.createElement('script');
  27. script.src = uri;
  28. script.onload = resolve;
  29. document.head.appendChild(script);
  30. } else {
  31. nextDefineUri = uri;
  32. importScripts(uri);
  33. resolve();
  34. }
  35. }).then(() => {
  36. const promise = registry[uri];
  37. if (!promise) {
  38. throw new Error(`Module ${uri} didn’t register its module`);
  39. }
  40. return promise;
  41. })
  42. );
  43. };
  44. self.define = (depsNames, factory) => {
  45. const uri =
  46. nextDefineUri ||
  47. ('document' in self ? document.currentScript.src : '') ||
  48. location.href;
  49. if (registry[uri]) {
  50. // Module is already loading or loaded.
  51. return;
  52. }
  53. const exports = {};
  54. const require = depUri => singleRequire(depUri, uri);
  55. const specialDeps = {
  56. module: { uri },
  57. exports,
  58. require
  59. };
  60. registry[uri] = Promise.all(
  61. depsNames.map(depName => specialDeps[depName] || require(depName))
  62. ).then(deps => {
  63. factory(...deps);
  64. return exports;
  65. });
  66. };
  67. }
  68. define(['./workbox-bb0550c6'], function (workbox) {
  69. 'use strict';
  70. self.skipWaiting();
  71. workbox.clientsClaim();
  72. /**
  73. * The precacheAndRoute() method efficiently caches and responds to
  74. * requests for URLs in the manifest.
  75. * See https://goo.gl/S9QRab
  76. */
  77. workbox.precacheAndRoute(
  78. [
  79. {
  80. url: 'registerSW.js',
  81. revision: '3ca0b8505b4bec776b69afdba2768812'
  82. },
  83. {
  84. url: 'index.html',
  85. revision: '0.te9il07ke8o'
  86. }
  87. ],
  88. {}
  89. );
  90. workbox.cleanupOutdatedCaches();
  91. workbox.registerRoute(
  92. new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
  93. allowlist: [/^\/$/]
  94. })
  95. );
  96. workbox.registerRoute(
  97. ({ url }) => url.origin === 'https://dev.kt.colexiu.com',
  98. new workbox.NetworkFirst({
  99. cacheName: 'api-cache',
  100. plugins: []
  101. }),
  102. 'GET'
  103. );
  104. });
  105. =======
  106. /**
  107. * Copyright 2018 Google Inc. All Rights Reserved.
  108. * Licensed under the Apache License, Version 2.0 (the "License");
  109. * you may not use this file except in compliance with the License.
  110. * You may obtain a copy of the License at
  111. * http://www.apache.org/licenses/LICENSE-2.0
  112. * Unless required by applicable law or agreed to in writing, software
  113. * distributed under the License is distributed on an "AS IS" BASIS,
  114. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  115. * See the License for the specific language governing permissions and
  116. * limitations under the License.
  117. */
  118. // If the loader is already loaded, just stop.
  119. if (!self.define) {
  120. let registry = {};
  121. // Used for `eval` and `importScripts` where we can't get script URL by other means.
  122. // In both cases, it's safe to use a global var because those functions are synchronous.
  123. let nextDefineUri;
  124. const singleRequire = (uri, parentUri) => {
  125. uri = new URL(uri + ".js", parentUri).href;
  126. return registry[uri] || (
  127. new Promise(resolve => {
  128. if ("document" in self) {
  129. const script = document.createElement("script");
  130. script.src = uri;
  131. script.onload = resolve;
  132. document.head.appendChild(script);
  133. } else {
  134. nextDefineUri = uri;
  135. importScripts(uri);
  136. resolve();
  137. }
  138. })
  139. .then(() => {
  140. let promise = registry[uri];
  141. if (!promise) {
  142. throw new Error(`Module ${uri} didn’t register its module`);
  143. }
  144. return promise;
  145. })
  146. );
  147. };
  148. self.define = (depsNames, factory) => {
  149. const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
  150. if (registry[uri]) {
  151. // Module is already loading or loaded.
  152. return;
  153. }
  154. let exports = {};
  155. const require = depUri => singleRequire(depUri, uri);
  156. const specialDeps = {
  157. module: { uri },
  158. exports,
  159. require
  160. };
  161. registry[uri] = Promise.all(depsNames.map(
  162. depName => specialDeps[depName] || require(depName)
  163. )).then(deps => {
  164. factory(...deps);
  165. return exports;
  166. });
  167. };
  168. }
  169. define(['./workbox-bb0550c6'], (function (workbox) { 'use strict';
  170. self.skipWaiting();
  171. workbox.clientsClaim();
  172. /**
  173. * The precacheAndRoute() method efficiently caches and responds to
  174. * requests for URLs in the manifest.
  175. * See https://goo.gl/S9QRab
  176. */
  177. workbox.precacheAndRoute([{
  178. "url": "registerSW.js",
  179. "revision": "3ca0b8505b4bec776b69afdba2768812"
  180. }, {
  181. "url": "index.html",
  182. "revision": "0.jfthsevatb8"
  183. }], {});
  184. workbox.cleanupOutdatedCaches();
  185. workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
  186. allowlist: [/^\/$/]
  187. }));
  188. workbox.registerRoute(({
  189. url
  190. }) => url.origin === "https://dev.kt.colexiu.com", new workbox.NetworkFirst({
  191. "cacheName": "api-cache",
  192. plugins: []
  193. }), 'GET');
  194. }));
  195. >>>>>>> iteration-20240607-small