sw.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * Copyright 2018 Google Inc. All Rights Reserved.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. * Unless required by applicable law or agreed to in writing, software
  8. * distributed under the License is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. * See the License for the specific language governing permissions and
  11. * limitations under the License.
  12. */
  13. // If the loader is already loaded, just stop.
  14. if (!self.define) {
  15. let registry = {};
  16. // Used for `eval` and `importScripts` where we can't get script URL by other means.
  17. // In both cases, it's safe to use a global var because those functions are synchronous.
  18. let nextDefineUri;
  19. const singleRequire = (uri, parentUri) => {
  20. uri = new URL(uri + '.js', parentUri).href;
  21. return (
  22. registry[uri] ||
  23. new Promise(resolve => {
  24. if ('document' in self) {
  25. const script = document.createElement('script');
  26. script.src = uri;
  27. script.onload = resolve;
  28. document.head.appendChild(script);
  29. } else {
  30. nextDefineUri = uri;
  31. importScripts(uri);
  32. resolve();
  33. }
  34. }).then(() => {
  35. let promise = registry[uri];
  36. if (!promise) {
  37. throw new Error(`Module ${uri} didn’t register its module`);
  38. }
  39. return promise;
  40. })
  41. );
  42. };
  43. self.define = (depsNames, factory) => {
  44. const uri =
  45. nextDefineUri ||
  46. ('document' in self ? document.currentScript.src : '') ||
  47. location.href;
  48. if (registry[uri]) {
  49. // Module is already loading or loaded.
  50. return;
  51. }
  52. let exports = {};
  53. const require = depUri => singleRequire(depUri, uri);
  54. const specialDeps = {
  55. module: { uri },
  56. exports,
  57. require
  58. };
  59. registry[uri] = Promise.all(
  60. depsNames.map(depName => specialDeps[depName] || require(depName))
  61. ).then(deps => {
  62. factory(...deps);
  63. return exports;
  64. });
  65. };
  66. }
  67. define(['./workbox-5357ef54'], function (workbox) {
  68. 'use strict';
  69. self.skipWaiting();
  70. workbox.clientsClaim();
  71. /**
  72. * The precacheAndRoute() method efficiently caches and responds to
  73. * requests for URLs in the manifest.
  74. * See https://goo.gl/S9QRab
  75. */
  76. <<<<<<< HEAD
  77. workbox.precacheAndRoute([{
  78. "url": "registerSW.js",
  79. "revision": "3ca0b8505b4bec776b69afdba2768812"
  80. }, {
  81. "url": "index.html",
  82. "revision": "0.uk5org9dss"
  83. }], {});
  84. =======
  85. workbox.precacheAndRoute(
  86. [
  87. {
  88. url: 'registerSW.js',
  89. revision: '3ca0b8505b4bec776b69afdba2768812'
  90. },
  91. {
  92. url: 'index.html',
  93. revision: '0.75vo45gt8f8'
  94. }
  95. ],
  96. {}
  97. );
  98. >>>>>>> startLogin
  99. workbox.cleanupOutdatedCaches();
  100. workbox.registerRoute(
  101. new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
  102. allowlist: [/^\/$/]
  103. })
  104. );
  105. });