jekyll-pwa-workbox 0.0.6 → 0.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-workbox.rb +2 -2
  3. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js +818 -0
  4. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js +288 -0
  8. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js +191 -0
  12. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/workbox-v5.1.3/workbox-core.dev.js +1858 -0
  16. data/lib/vendor/workbox-v5.1.3/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.1.3/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.1.3/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js +649 -0
  20. data/lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js +102 -0
  24. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/{workbox-v4.3.1 → workbox-v5.1.3}/workbox-navigation-preload.prod.js +1 -1
  26. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js +235 -0
  28. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js +1210 -0
  32. data/lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js +262 -0
  36. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/workbox-v5.1.3/workbox-routing.dev.js +923 -0
  40. data/lib/vendor/workbox-v5.1.3/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.1.3/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.1.3/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js +923 -0
  44. data/lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/workbox-v5.1.3/workbox-streams.dev.js +318 -0
  48. data/lib/vendor/workbox-v5.1.3/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.1.3/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.1.3/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.1.3/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.1.3/workbox-sw.js.map +1 -0
  53. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs +1094 -0
  54. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs +943 -0
  56. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js +1105 -0
  58. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js.map +1 -0
  65. metadata +73 -78
  66. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js +0 -822
  67. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js +0 -2
  69. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js.map +0 -1
  70. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js +0 -496
  71. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js.map +0 -1
  72. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js +0 -2
  73. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js.map +0 -1
  74. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js +0 -200
  75. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js.map +0 -1
  76. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js +0 -2
  77. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js.map +0 -1
  78. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js +0 -1712
  79. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js +0 -2
  81. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js +0 -652
  83. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js.map +0 -1
  84. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js +0 -2
  85. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js.map +0 -1
  86. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js +0 -110
  87. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js.map +0 -1
  88. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js.map +0 -1
  89. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js +0 -243
  90. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js.map +0 -1
  91. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js +0 -2
  92. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js.map +0 -1
  93. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js +0 -989
  94. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js.map +0 -1
  95. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js +0 -2
  96. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js.map +0 -1
  97. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js +0 -268
  98. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js.map +0 -1
  99. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js +0 -2
  100. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js.map +0 -1
  101. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js +0 -1020
  102. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js.map +0 -1
  103. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js +0 -2
  104. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js.map +0 -1
  105. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js +0 -1138
  106. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js.map +0 -1
  107. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js +0 -2
  108. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js.map +0 -1
  109. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js +0 -337
  110. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js.map +0 -1
  111. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js +0 -2
  112. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js.map +0 -1
  113. data/lib/vendor/workbox-v4.3.1/workbox-sw.js +0 -2
  114. data/lib/vendor/workbox-v4.3.1/workbox-sw.js.map +0 -1
  115. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs +0 -885
  116. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs.map +0 -1
  117. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs +0 -751
  118. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs.map +0 -1
  119. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js +0 -896
  120. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js.map +0 -1
  121. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs +0 -2
  122. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs.map +0 -1
  123. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs +0 -2
  124. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs.map +0 -1
  125. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js +0 -2
  126. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"workbox-window.dev.mjs","sources":["../_version.mjs","../messageSW.mjs","../../workbox-core/_version.mjs","../../workbox-core/_private/Deferred.mjs","../../workbox-core/_private/logger.mjs","../utils/EventTargetShim.mjs","../utils/urlsMatch.mjs","../utils/WorkboxEvent.mjs","../Workbox.mjs","../index.mjs"],"sourcesContent":["try{self['workbox:window:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport './_version.mjs';\n\n\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise<Object|undefined>}\n *\n * @memberof module:workbox-window\n */\nconst messageSW = (sw, data) => {\n return new Promise((resolve) => {\n let messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (evt) => resolve(evt.data);\n sw.postMessage(data, [messageChannel.port2]);\n });\n};\n\nexport {messageSW};\n","try{self['workbox:core:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nexport class Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n\nconst logger = process.env.NODE_ENV === 'production' ? null : (() => {\n let inGroup = false;\n\n const methodToColorMap = {\n debug: `#7f8c8d`, // Gray\n log: `#2ecc71`, // Green\n warn: `#f39c12`, // Yellow\n error: `#c0392b`, // Red\n groupCollapsed: `#3498db`, // Blue\n groupEnd: null, // No colored prefix on groupEnd\n };\n\n const print = function(method, args) {\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n\n console[method](...logPrefix, ...args);\n\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n\n const api = {};\n for (const method of Object.keys(methodToColorMap)) {\n api[method] = (...args) => {\n print(method, args);\n };\n }\n\n return api;\n})();\n\nexport {logger};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nclass EventTargetShim {\n /**\n * Creates an event listener registry\n *\n * @private\n */\n constructor() {\n // A registry of event types to listeners.\n this._eventListenerRegistry = {};\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n this._getEventListenersByType(type).add(listener);\n }\n\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n\n /**\n * @param {Event} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n this._getEventListenersByType(event.type).forEach(\n (listener) => listener(event));\n }\n\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n return this._eventListenerRegistry[type] =\n (this._eventListenerRegistry[type] || new Set());\n }\n}\n\nexport {EventTargetShim};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nconst urlsMatch = (url1, url2) => {\n return new URL(url1, location).href === new URL(url2, location).href;\n};\n\nexport {urlsMatch};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nclass WorkboxEvent {\n /**\n * @param {string} type\n * @param {Object} props\n */\n constructor(type, props) {\n Object.assign(this, props, {type});\n }\n}\n\nexport {WorkboxEvent};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {Deferred} from 'workbox-core/_private/Deferred.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {messageSW} from './messageSW.mjs';\nimport {EventTargetShim} from './utils/EventTargetShim.mjs';\nimport {urlsMatch} from './utils/urlsMatch.mjs';\nimport {WorkboxEvent} from './utils/WorkboxEvent.mjs';\nimport './_version.mjs';\n\n\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires [message]{@link module:workbox-window.Workbox#message}\n * @fires [installed]{@link module:workbox-window.Workbox#installed}\n * @fires [waiting]{@link module:workbox-window.Workbox#waiting}\n * @fires [controlling]{@link module:workbox-window.Workbox#controlling}\n * @fires [activated]{@link module:workbox-window.Workbox#activated}\n * @fires [redundant]{@link module:workbox-window.Workbox#redundant}\n * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}\n * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}\n * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}\n *\n * @memberof module:workbox-window\n */\nclass Workbox extends EventTargetShim {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling `navigator.serviceWorker.register(scriptURL, options)`. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n *\n * @param {string} scriptURL The service worker script associated with this\n * instance.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n constructor(scriptURL, registerOptions = {}) {\n super();\n\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n this._updateFoundCount = 0;\n\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n\n // Bind event handler callbacks.\n this._onMessage = this._onMessage.bind(this);\n this._onStateChange = this._onStateChange.bind(this);\n this._onUpdateFound = this._onUpdateFound.bind(this);\n this._onControllerChange = this._onControllerChange.bind(this);\n }\n\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({immediate = false} = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => addEventListener('load', res));\n }\n\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n\n this._registration = await this._registerScript();\n\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n\n this._reportWindowReady(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener(\n 'statechange', this._onStateChange, {once: true});\n }\n\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the prevoius\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n });\n }\n\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\n\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n } else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(\n this._registerOptions.scope || this._scriptURL, document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener(\n 'controllerchange', this._onControllerChange, {once: true});\n\n // Add message listeners.\n if ('BroadcastChannel' in self) {\n this._broadcastChannel = new BroadcastChannel('workbox');\n this._broadcastChannel.addEventListener('message', this._onMessage);\n }\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n\n return this._registration;\n }\n\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise<ServiceWorker>}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise<ServiceWorker>}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise<ServiceWorker>}\n */\n async getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw || this._swDeferred.promise;\n }\n\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise<Object>}\n */\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matchs.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {\n return controller;\n }\n }\n\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n const reg = await navigator.serviceWorker.register(\n this._scriptURL, this._registerOptions);\n\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n\n return reg;\n } catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n\n\n /**\n * Sends a message to the passed service worker that the window is ready.\n *\n * @param {ServiceWorker} sw\n * @private\n */\n _reportWindowReady(sw) {\n messageSW(sw, {\n type: 'WINDOW_READY',\n meta: 'workbox-window',\n });\n }\n\n /**\n * @private\n */\n _onUpdateFound() {\n const installingSW = this._registration.installing;\n\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n let updateLikelyTriggeredExternally =\n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n (performance.now() >\n this._registrationTime + REGISTRATION_TIMEOUT_DURATION) ?\n // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true : false;\n\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n this._registration.removeEventListener(\n 'updatefound', this._onUpdateFound);\n } else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._swDeferred.resolve(installingSW);\n\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n } else {\n logger.log('Service worker is installing...');\n }\n }\n }\n\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n }\n\n /**\n * @private\n * @param {Event} originalEvent\n */\n _onStateChange(originalEvent) {\n const sw = originalEvent.target;\n const {state} = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n\n const eventProps = {sw, originalEvent};\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n\n this.dispatchEvent(new WorkboxEvent(\n eventPrefix + state, eventProps));\n\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && this._registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(\n eventPrefix + 'waiting', eventProps));\n\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n } else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n } else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n } else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n } else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n } else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n }\n\n /**\n * @private\n * @param {Event} originalEvent\n */\n _onControllerChange(originalEvent) {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {sw, originalEvent}));\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n }\n\n /**\n * @private\n * @param {Event} originalEvent\n */\n _onMessage(originalEvent) {\n const {data} = originalEvent;\n this.dispatchEvent(new WorkboxEvent('message', {data, originalEvent}));\n }\n}\n\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n\n/**\n * The `message` event is dispatched any time a `postMessage` (or a\n * `BroadcastChannel` message with the `workbox` channel name) is received.\n *\n * @event module:workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `installed` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event module:workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `waiting` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}\n * method was called.\n *\n * @event module:workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The native `controllerchange` event\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event module:workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `activated` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `redundant` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event module:workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-external-sw}\n * changes to `installed`.\n *\n * @event module:workbox-window.Workbox#externalinstalled\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalinstalled`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-external-sw}\n * changes to `waiting`.\n *\n * @event module:workbox-window.Workbox#externalwaiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalwaiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-external-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#externalactivated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalactivated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\nexport {Workbox};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {messageSW} from './messageSW.mjs';\nimport {Workbox} from './Workbox.mjs';\nimport './_version.mjs';\n\n\n/**\n * @module workbox-window\n */\nexport {\n Workbox,\n messageSW,\n};\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","evt","postMessage","port2","Deferred","constructor","promise","reject","logger","process","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","test","navigator","userAgent","console","styles","logPrefix","join","api","Object","keys","EventTargetShim","_eventListenerRegistry","addEventListener","type","listener","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","event","target","forEach","Set","urlsMatch","url1","url2","URL","location","href","WorkboxEvent","props","assign","WAITING_TIMEOUT_DURATION","REGISTRATION_TIMEOUT_DURATION","Workbox","scriptURL","registerOptions","_scriptURL","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_onMessage","bind","_onStateChange","_onUpdateFound","_onControllerChange","register","immediate","_registrationTime","document","readyState","res","_isUpdate","Boolean","serviceWorker","controller","_compatibleControllingSW","_getControllingSWIfCompatible","_registration","_registerScript","_sw","_reportWindowReady","once","waitingSW","waiting","then","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","_broadcastChannel","BroadcastChannel","active","controlling","getSW","reg","performance","now","meta","installingSW","installing","updateLikelyTriggeredExternally","_externalSW","originalEvent","state","isExternal","eventPrefix","eventProps","isUpdate","_waitingTimeout","setTimeout","clearTimeout"],"mappings":"AAAA,IAAG;EAACA,IAAI,CAAC,sBAAD,CAAJ,IAA8BC,CAAC,EAA/B;CAAJ,CAAsC,OAAMC,CAAN,EAAQ;;ACA9C;;;;;;;AAQA,AAGA;;;;;;;;;;;;;;;;AAeA,MAAMC,SAAS,GAAG,CAACC,EAAD,EAAKC,IAAL,KAAc;SACvB,IAAIC,OAAJ,CAAaC,OAAD,IAAa;QAC1BC,cAAc,GAAG,IAAIC,cAAJ,EAArB;;IACAD,cAAc,CAACE,KAAf,CAAqBC,SAArB,GAAkCC,GAAD,IAASL,OAAO,CAACK,GAAG,CAACP,IAAL,CAAjD;;IACAD,EAAE,CAACS,WAAH,CAAeR,IAAf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,YAAJ,CAAiB,SAAjB,EAA4B;MAACzD,IAAD;MAAOqH;KAAnC,CAAnB;;;;;ACneJ;;;;;;;;;;"}
@@ -1,896 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = global || self, factory(global.workbox = {}));
5
- }(this, function (exports) { 'use strict';
6
-
7
- try {
8
- self['workbox:window:4.3.1'] && _();
9
- } catch (e) {} // eslint-disable-line
10
-
11
- /*
12
- Copyright 2019 Google LLC
13
-
14
- Use of this source code is governed by an MIT-style
15
- license that can be found in the LICENSE file or at
16
- https://opensource.org/licenses/MIT.
17
- */
18
- /**
19
- * Sends a data object to a service worker via `postMessage` and resolves with
20
- * a response (if any).
21
- *
22
- * A response can be set in a message handler in the service worker by
23
- * calling `event.ports[0].postMessage(...)`, which will resolve the promise
24
- * returned by `messageSW()`. If no response is set, the promise will not
25
- * resolve.
26
- *
27
- * @param {ServiceWorker} sw The service worker to send the message to.
28
- * @param {Object} data An object to send to the service worker.
29
- * @return {Promise<Object|undefined>}
30
- *
31
- * @memberof module:workbox-window
32
- */
33
-
34
- var messageSW = function messageSW(sw, data) {
35
- return new Promise(function (resolve) {
36
- var messageChannel = new MessageChannel();
37
-
38
- messageChannel.port1.onmessage = function (evt) {
39
- return resolve(evt.data);
40
- };
41
-
42
- sw.postMessage(data, [messageChannel.port2]);
43
- });
44
- };
45
-
46
- function _defineProperties(target, props) {
47
- for (var i = 0; i < props.length; i++) {
48
- var descriptor = props[i];
49
- descriptor.enumerable = descriptor.enumerable || false;
50
- descriptor.configurable = true;
51
- if ("value" in descriptor) descriptor.writable = true;
52
- Object.defineProperty(target, descriptor.key, descriptor);
53
- }
54
- }
55
-
56
- function _createClass(Constructor, protoProps, staticProps) {
57
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
58
- if (staticProps) _defineProperties(Constructor, staticProps);
59
- return Constructor;
60
- }
61
-
62
- function _inheritsLoose(subClass, superClass) {
63
- subClass.prototype = Object.create(superClass.prototype);
64
- subClass.prototype.constructor = subClass;
65
- subClass.__proto__ = superClass;
66
- }
67
-
68
- function _assertThisInitialized(self) {
69
- if (self === void 0) {
70
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
71
- }
72
-
73
- return self;
74
- }
75
-
76
- try {
77
- self['workbox:core:4.3.1'] && _();
78
- } catch (e) {} // eslint-disable-line
79
-
80
- /*
81
- Copyright 2018 Google LLC
82
-
83
- Use of this source code is governed by an MIT-style
84
- license that can be found in the LICENSE file or at
85
- https://opensource.org/licenses/MIT.
86
- */
87
- /**
88
- * The Deferred class composes Promises in a way that allows for them to be
89
- * resolved or rejected from outside the constructor. In most cases promises
90
- * should be used directly, but Deferreds can be necessary when the logic to
91
- * resolve a promise must be separate.
92
- *
93
- * @private
94
- */
95
-
96
- var Deferred =
97
- /**
98
- * Creates a promise and exposes its resolve and reject functions as methods.
99
- */
100
- function Deferred() {
101
- var _this = this;
102
-
103
- this.promise = new Promise(function (resolve, reject) {
104
- _this.resolve = resolve;
105
- _this.reject = reject;
106
- });
107
- };
108
-
109
- /*
110
- Copyright 2019 Google LLC
111
- Use of this source code is governed by an MIT-style
112
- license that can be found in the LICENSE file or at
113
- https://opensource.org/licenses/MIT.
114
- */
115
- var logger = function () {
116
- var inGroup = false;
117
- var methodToColorMap = {
118
- debug: "#7f8c8d",
119
- // Gray
120
- log: "#2ecc71",
121
- // Green
122
- warn: "#f39c12",
123
- // Yellow
124
- error: "#c0392b",
125
- // Red
126
- groupCollapsed: "#3498db",
127
- // Blue
128
- groupEnd: null // No colored prefix on groupEnd
129
-
130
- };
131
-
132
- var print = function print(method, args) {
133
- var _console2;
134
-
135
- if (method === 'groupCollapsed') {
136
- // Safari doesn't print all console.groupCollapsed() arguments:
137
- // https://bugs.webkit.org/show_bug.cgi?id=182754
138
- if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
139
- var _console;
140
-
141
- (_console = console)[method].apply(_console, args);
142
-
143
- return;
144
- }
145
- }
146
-
147
- var styles = ["background: " + methodToColorMap[method], "border-radius: 0.5em", "color: white", "font-weight: bold", "padding: 2px 0.5em"]; // When in a group, the workbox prefix is not displayed.
148
-
149
- var logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
150
-
151
- (_console2 = console)[method].apply(_console2, logPrefix.concat(args));
152
-
153
- if (method === 'groupCollapsed') {
154
- inGroup = true;
155
- }
156
-
157
- if (method === 'groupEnd') {
158
- inGroup = false;
159
- }
160
- };
161
-
162
- var api = {};
163
-
164
- var _arr = Object.keys(methodToColorMap);
165
-
166
- var _loop = function _loop() {
167
- var method = _arr[_i];
168
-
169
- api[method] = function () {
170
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
171
- args[_key] = arguments[_key];
172
- }
173
-
174
- print(method, args);
175
- };
176
- };
177
-
178
- for (var _i = 0; _i < _arr.length; _i++) {
179
- _loop();
180
- }
181
-
182
- return api;
183
- }();
184
-
185
- /*
186
- Copyright 2019 Google LLC
187
-
188
- Use of this source code is governed by an MIT-style
189
- license that can be found in the LICENSE file or at
190
- https://opensource.org/licenses/MIT.
191
- */
192
- /**
193
- * A minimal `EventTarget` shim.
194
- * This is necessary because not all browsers support constructable
195
- * `EventTarget`, so using a real `EventTarget` will error.
196
- * @private
197
- */
198
-
199
- var EventTargetShim =
200
- /*#__PURE__*/
201
- function () {
202
- /**
203
- * Creates an event listener registry
204
- *
205
- * @private
206
- */
207
- function EventTargetShim() {
208
- // A registry of event types to listeners.
209
- this._eventListenerRegistry = {};
210
- }
211
- /**
212
- * @param {string} type
213
- * @param {Function} listener
214
- * @private
215
- */
216
-
217
-
218
- var _proto = EventTargetShim.prototype;
219
-
220
- _proto.addEventListener = function addEventListener(type, listener) {
221
- this._getEventListenersByType(type).add(listener);
222
- };
223
- /**
224
- * @param {string} type
225
- * @param {Function} listener
226
- * @private
227
- */
228
-
229
-
230
- _proto.removeEventListener = function removeEventListener(type, listener) {
231
- this._getEventListenersByType(type).delete(listener);
232
- };
233
- /**
234
- * @param {Event} event
235
- * @private
236
- */
237
-
238
-
239
- _proto.dispatchEvent = function dispatchEvent(event) {
240
- event.target = this;
241
-
242
- this._getEventListenersByType(event.type).forEach(function (listener) {
243
- return listener(event);
244
- });
245
- };
246
- /**
247
- * Returns a Set of listeners associated with the passed event type.
248
- * If no handlers have been registered, an empty Set is returned.
249
- *
250
- * @param {string} type The event type.
251
- * @return {Set} An array of handler functions.
252
- * @private
253
- */
254
-
255
-
256
- _proto._getEventListenersByType = function _getEventListenersByType(type) {
257
- return this._eventListenerRegistry[type] = this._eventListenerRegistry[type] || new Set();
258
- };
259
-
260
- return EventTargetShim;
261
- }();
262
-
263
- /*
264
- Copyright 2019 Google LLC
265
-
266
- Use of this source code is governed by an MIT-style
267
- license that can be found in the LICENSE file or at
268
- https://opensource.org/licenses/MIT.
269
- */
270
- /**
271
- * Returns true if two URLs have the same `.href` property. The URLS can be
272
- * relative, and if they are the current location href is used to resolve URLs.
273
- *
274
- * @private
275
- * @param {string} url1
276
- * @param {string} url2
277
- * @return {boolean}
278
- */
279
-
280
- var urlsMatch = function urlsMatch(url1, url2) {
281
- return new URL(url1, location).href === new URL(url2, location).href;
282
- };
283
-
284
- /*
285
- Copyright 2019 Google LLC
286
-
287
- Use of this source code is governed by an MIT-style
288
- license that can be found in the LICENSE file or at
289
- https://opensource.org/licenses/MIT.
290
- */
291
- /**
292
- * A minimal `Event` subclass shim.
293
- * This doesn't *actually* subclass `Event` because not all browsers support
294
- * constructable `EventTarget`, and using a real `Event` will error.
295
- * @private
296
- */
297
-
298
- var WorkboxEvent =
299
- /**
300
- * @param {string} type
301
- * @param {Object} props
302
- */
303
- function WorkboxEvent(type, props) {
304
- Object.assign(this, props, {
305
- type: type
306
- });
307
- };
308
-
309
- function _catch(body, recover) {
310
- try {
311
- var result = body();
312
- } catch (e) {
313
- return recover(e);
314
- }
315
-
316
- if (result && result.then) {
317
- return result.then(void 0, recover);
318
- }
319
-
320
- return result;
321
- }
322
-
323
- function _async(f) {
324
- return function () {
325
- for (var args = [], i = 0; i < arguments.length; i++) {
326
- args[i] = arguments[i];
327
- }
328
-
329
- try {
330
- return Promise.resolve(f.apply(this, args));
331
- } catch (e) {
332
- return Promise.reject(e);
333
- }
334
- };
335
- }
336
-
337
- function _invoke(body, then) {
338
- var result = body();
339
-
340
- if (result && result.then) {
341
- return result.then(then);
342
- }
343
-
344
- return then(result);
345
- }
346
-
347
- function _await(value, then, direct) {
348
- if (direct) {
349
- return then ? then(value) : value;
350
- }
351
-
352
- if (!value || !value.then) {
353
- value = Promise.resolve(value);
354
- }
355
-
356
- return then ? value.then(then) : value;
357
- }
358
-
359
- function _awaitIgnored(value, direct) {
360
- if (!direct) {
361
- return value && value.then ? value.then(_empty) : Promise.resolve();
362
- }
363
- }
364
-
365
- function _empty() {}
366
- // `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
367
- // chosen, but it seems to avoid false positives in my testing.
368
-
369
- var WAITING_TIMEOUT_DURATION = 200; // The amount of time after a registration that we can reasonably conclude
370
- // that the registration didn't trigger an update.
371
-
372
- var REGISTRATION_TIMEOUT_DURATION = 60000;
373
- /**
374
- * A class to aid in handling service worker registration, updates, and
375
- * reacting to service worker lifecycle events.
376
- *
377
- * @fires [message]{@link module:workbox-window.Workbox#message}
378
- * @fires [installed]{@link module:workbox-window.Workbox#installed}
379
- * @fires [waiting]{@link module:workbox-window.Workbox#waiting}
380
- * @fires [controlling]{@link module:workbox-window.Workbox#controlling}
381
- * @fires [activated]{@link module:workbox-window.Workbox#activated}
382
- * @fires [redundant]{@link module:workbox-window.Workbox#redundant}
383
- * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}
384
- * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}
385
- * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}
386
- *
387
- * @memberof module:workbox-window
388
- */
389
-
390
- var Workbox =
391
- /*#__PURE__*/
392
- function (_EventTargetShim) {
393
- _inheritsLoose(Workbox, _EventTargetShim);
394
-
395
- /**
396
- * Creates a new Workbox instance with a script URL and service worker
397
- * options. The script URL and options are the same as those used when
398
- * calling `navigator.serviceWorker.register(scriptURL, options)`. See:
399
- * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register
400
- *
401
- * @param {string} scriptURL The service worker script associated with this
402
- * instance.
403
- * @param {Object} [registerOptions] The service worker options associated
404
- * with this instance.
405
- */
406
- function Workbox(scriptURL, registerOptions) {
407
- var _this;
408
-
409
- if (registerOptions === void 0) {
410
- registerOptions = {};
411
- }
412
-
413
- _this = _EventTargetShim.call(this) || this;
414
- _this._scriptURL = scriptURL;
415
- _this._registerOptions = registerOptions;
416
- _this._updateFoundCount = 0; // Deferreds we can resolve later.
417
-
418
- _this._swDeferred = new Deferred();
419
- _this._activeDeferred = new Deferred();
420
- _this._controllingDeferred = new Deferred(); // Bind event handler callbacks.
421
-
422
- _this._onMessage = _this._onMessage.bind(_assertThisInitialized(_assertThisInitialized(_this)));
423
- _this._onStateChange = _this._onStateChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
424
- _this._onUpdateFound = _this._onUpdateFound.bind(_assertThisInitialized(_assertThisInitialized(_this)));
425
- _this._onControllerChange = _this._onControllerChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
426
- return _this;
427
- }
428
- /**
429
- * Registers a service worker for this instances script URL and service
430
- * worker options. By default this method delays registration until after
431
- * the window has loaded.
432
- *
433
- * @param {Object} [options]
434
- * @param {Function} [options.immediate=false] Setting this to true will
435
- * register the service worker immediately, even if the window has
436
- * not loaded (not recommended).
437
- */
438
-
439
-
440
- var _proto = Workbox.prototype;
441
- _proto.register = _async(function (_temp) {
442
- var _this2 = this;
443
-
444
- var _ref = _temp === void 0 ? {} : _temp,
445
- _ref$immediate = _ref.immediate,
446
- immediate = _ref$immediate === void 0 ? false : _ref$immediate;
447
-
448
- {
449
- if (_this2._registrationTime) {
450
- logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
451
- return;
452
- }
453
- }
454
-
455
- return _invoke(function () {
456
- if (!immediate && document.readyState !== 'complete') {
457
- return _awaitIgnored(new Promise(function (res) {
458
- return addEventListener('load', res);
459
- }));
460
- }
461
- }, function () {
462
- // Set this flag to true if any service worker was controlling the page
463
- // at registration time.
464
- _this2._isUpdate = Boolean(navigator.serviceWorker.controller); // Before registering, attempt to determine if a SW is already controlling
465
- // the page, and if that SW script (and version, if specified) matches this
466
- // instance's script.
467
-
468
- _this2._compatibleControllingSW = _this2._getControllingSWIfCompatible();
469
- return _await(_this2._registerScript(), function (_this2$_registerScrip) {
470
- _this2._registration = _this2$_registerScrip;
471
-
472
- // If we have a compatible controller, store the controller as the "own"
473
- // SW, resolve active/controlling deferreds and add necessary listeners.
474
- if (_this2._compatibleControllingSW) {
475
- _this2._sw = _this2._compatibleControllingSW;
476
-
477
- _this2._activeDeferred.resolve(_this2._compatibleControllingSW);
478
-
479
- _this2._controllingDeferred.resolve(_this2._compatibleControllingSW);
480
-
481
- _this2._reportWindowReady(_this2._compatibleControllingSW);
482
-
483
- _this2._compatibleControllingSW.addEventListener('statechange', _this2._onStateChange, {
484
- once: true
485
- });
486
- } // If there's a waiting service worker with a matching URL before the
487
- // `updatefound` event fires, it likely means that this site is open
488
- // in another tab, or the user refreshed the page (and thus the prevoius
489
- // page wasn't fully unloaded before this page started loading).
490
- // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
491
-
492
-
493
- var waitingSW = _this2._registration.waiting;
494
-
495
- if (waitingSW && urlsMatch(waitingSW.scriptURL, _this2._scriptURL)) {
496
- // Store the waiting SW as the "own" Sw, even if it means overwriting
497
- // a compatible controller.
498
- _this2._sw = waitingSW; // Run this in the next microtask, so any code that adds an event
499
- // listener after awaiting `register()` will get this event.
500
-
501
- Promise.resolve().then(function () {
502
- _this2.dispatchEvent(new WorkboxEvent('waiting', {
503
- sw: waitingSW,
504
- wasWaitingBeforeRegister: true
505
- }));
506
-
507
- {
508
- logger.warn('A service worker was already waiting to activate ' + 'before this script was registered...');
509
- }
510
- });
511
- } // If an "own" SW is already set, resolve the deferred.
512
-
513
-
514
- if (_this2._sw) {
515
- _this2._swDeferred.resolve(_this2._sw);
516
- }
517
-
518
- {
519
- logger.log('Successfully registered service worker.', _this2._scriptURL);
520
-
521
- if (navigator.serviceWorker.controller) {
522
- if (_this2._compatibleControllingSW) {
523
- logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
524
- } else {
525
- logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
526
- }
527
- }
528
-
529
- var currentPageIsOutOfScope = function currentPageIsOutOfScope() {
530
- var scopeURL = new URL(_this2._registerOptions.scope || _this2._scriptURL, document.baseURI);
531
- var scopeURLBasePath = new URL('./', scopeURL.href).pathname;
532
- return !location.pathname.startsWith(scopeURLBasePath);
533
- };
534
-
535
- if (currentPageIsOutOfScope()) {
536
- logger.warn('The current page is not in scope for the registered ' + 'service worker. Was this a mistake?');
537
- }
538
- }
539
-
540
- _this2._registration.addEventListener('updatefound', _this2._onUpdateFound);
541
-
542
- navigator.serviceWorker.addEventListener('controllerchange', _this2._onControllerChange, {
543
- once: true
544
- }); // Add message listeners.
545
-
546
- if ('BroadcastChannel' in self) {
547
- _this2._broadcastChannel = new BroadcastChannel('workbox');
548
-
549
- _this2._broadcastChannel.addEventListener('message', _this2._onMessage);
550
- }
551
-
552
- navigator.serviceWorker.addEventListener('message', _this2._onMessage);
553
- return _this2._registration;
554
- });
555
- });
556
- });
557
- /**
558
- * Resolves to the service worker registered by this instance as soon as it
559
- * is active. If a service worker was already controlling at registration
560
- * time then it will resolve to that if the script URLs (and optionally
561
- * script versions) match, otherwise it will wait until an update is found
562
- * and activates.
563
- *
564
- * @return {Promise<ServiceWorker>}
565
- */
566
-
567
- /**
568
- * Resolves with a reference to a service worker that matches the script URL
569
- * of this instance, as soon as it's available.
570
- *
571
- * If, at registration time, there's already an active or waiting service
572
- * worker with a matching script URL, it will be used (with the waiting
573
- * service worker taking precedence over the active service worker if both
574
- * match, since the waiting service worker would have been registered more
575
- * recently).
576
- * If there's no matching active or waiting service worker at registration
577
- * time then the promise will not resolve until an update is found and starts
578
- * installing, at which point the installing service worker is used.
579
- *
580
- * @return {Promise<ServiceWorker>}
581
- */
582
- _proto.getSW = _async(function () {
583
- var _this3 = this;
584
-
585
- // If `this._sw` is set, resolve with that as we want `getSW()` to
586
- // return the correct (new) service worker if an update is found.
587
- return _this3._sw || _this3._swDeferred.promise;
588
- });
589
- /**
590
- * Sends the passed data object to the service worker registered by this
591
- * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves
592
- * with a response (if any).
593
- *
594
- * A response can be set in a message handler in the service worker by
595
- * calling `event.ports[0].postMessage(...)`, which will resolve the promise
596
- * returned by `messageSW()`. If no response is set, the promise will never
597
- * resolve.
598
- *
599
- * @param {Object} data An object to send to the service worker
600
- * @return {Promise<Object>}
601
- */
602
-
603
- _proto.messageSW = _async(function (data) {
604
- var _this4 = this;
605
-
606
- return _await(_this4.getSW(), function (sw) {
607
- return messageSW(sw, data);
608
- });
609
- });
610
- /**
611
- * Checks for a service worker already controlling the page and returns
612
- * it if its script URL matchs.
613
- *
614
- * @private
615
- * @return {ServiceWorker|undefined}
616
- */
617
-
618
- _proto._getControllingSWIfCompatible = function _getControllingSWIfCompatible() {
619
- var controller = navigator.serviceWorker.controller;
620
-
621
- if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {
622
- return controller;
623
- }
624
- };
625
- /**
626
- * Registers a service worker for this instances script URL and register
627
- * options and tracks the time registration was complete.
628
- *
629
- * @private
630
- */
631
-
632
-
633
- _proto._registerScript = _async(function () {
634
- var _this5 = this;
635
-
636
- return _catch(function () {
637
- return _await(navigator.serviceWorker.register(_this5._scriptURL, _this5._registerOptions), function (reg) {
638
- // Keep track of when registration happened, so it can be used in the
639
- // `this._onUpdateFound` heuristic. Also use the presence of this
640
- // property as a way to see if `.register()` has been called.
641
- _this5._registrationTime = performance.now();
642
- return reg;
643
- });
644
- }, function (error) {
645
- {
646
- logger.error(error);
647
- } // Re-throw the error.
648
-
649
-
650
- throw error;
651
- });
652
- });
653
- /**
654
- * Sends a message to the passed service worker that the window is ready.
655
- *
656
- * @param {ServiceWorker} sw
657
- * @private
658
- */
659
-
660
- _proto._reportWindowReady = function _reportWindowReady(sw) {
661
- messageSW(sw, {
662
- type: 'WINDOW_READY',
663
- meta: 'workbox-window'
664
- });
665
- };
666
- /**
667
- * @private
668
- */
669
-
670
-
671
- _proto._onUpdateFound = function _onUpdateFound() {
672
- var installingSW = this._registration.installing; // If the script URL passed to `navigator.serviceWorker.register()` is
673
- // different from the current controlling SW's script URL, we know any
674
- // successful registration calls will trigger an `updatefound` event.
675
- // But if the registered script URL is the same as the current controlling
676
- // SW's script URL, we'll only get an `updatefound` event if the file
677
- // changed since it was last registered. This can be a problem if the user
678
- // opens up the same page in a different tab, and that page registers
679
- // a SW that triggers an update. It's a problem because this page has no
680
- // good way of knowing whether the `updatefound` event came from the SW
681
- // script it registered or from a registration attempt made by a newer
682
- // version of the page running in another tab.
683
- // To minimize the possibility of a false positive, we use the logic here:
684
-
685
- var updateLikelyTriggeredExternally = // Since we enforce only calling `register()` once, and since we don't
686
- // add the `updatefound` event listener until the `register()` call, if
687
- // `_updateFoundCount` is > 0 then it means this method has already
688
- // been called, thus this SW must be external
689
- this._updateFoundCount > 0 || // If the script URL of the installing SW is different from this
690
- // instance's script URL, we know it's definitely not from our
691
- // registration.
692
- !urlsMatch(installingSW.scriptURL, this._scriptURL) || // If all of the above are false, then we use a time-based heuristic:
693
- // Any `updatefound` event that occurs long after our registration is
694
- // assumed to be external.
695
- performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION ? // If any of the above are not true, we assume the update was
696
- // triggered by this instance.
697
- true : false;
698
-
699
- if (updateLikelyTriggeredExternally) {
700
- this._externalSW = installingSW;
701
-
702
- this._registration.removeEventListener('updatefound', this._onUpdateFound);
703
- } else {
704
- // If the update was not triggered externally we know the installing
705
- // SW is the one we registered, so we set it.
706
- this._sw = installingSW;
707
-
708
- this._swDeferred.resolve(installingSW); // The `installing` state isn't something we have a dedicated
709
- // callback for, but we do log messages for it in development.
710
-
711
-
712
- {
713
- if (navigator.serviceWorker.controller) {
714
- logger.log('Updated service worker found. Installing now...');
715
- } else {
716
- logger.log('Service worker is installing...');
717
- }
718
- }
719
- } // Increment the `updatefound` count, so future invocations of this
720
- // method can be sure they were triggered externally.
721
-
722
-
723
- ++this._updateFoundCount; // Add a `statechange` listener regardless of whether this update was
724
- // triggered externally, since we have callbacks for both.
725
-
726
- installingSW.addEventListener('statechange', this._onStateChange);
727
- };
728
- /**
729
- * @private
730
- * @param {Event} originalEvent
731
- */
732
-
733
-
734
- _proto._onStateChange = function _onStateChange(originalEvent) {
735
- var _this6 = this;
736
-
737
- var sw = originalEvent.target;
738
- var state = sw.state;
739
- var isExternal = sw === this._externalSW;
740
- var eventPrefix = isExternal ? 'external' : '';
741
- var eventProps = {
742
- sw: sw,
743
- originalEvent: originalEvent
744
- };
745
-
746
- if (!isExternal && this._isUpdate) {
747
- eventProps.isUpdate = true;
748
- }
749
-
750
- this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));
751
-
752
- if (state === 'installed') {
753
- // This timeout is used to ignore cases where the service worker calls
754
- // `skipWaiting()` in the install event, thus moving it directly in the
755
- // activating state. (Since all service workers *must* go through the
756
- // waiting phase, the only way to detect `skipWaiting()` called in the
757
- // install event is to observe that the time spent in the waiting phase
758
- // is very short.)
759
- // NOTE: we don't need separate timeouts for the own and external SWs
760
- // since they can't go through these phases at the same time.
761
- this._waitingTimeout = setTimeout(function () {
762
- // Ensure the SW is still waiting (it may now be redundant).
763
- if (state === 'installed' && _this6._registration.waiting === sw) {
764
- _this6.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));
765
-
766
- {
767
- if (isExternal) {
768
- logger.warn('An external service worker has installed but is ' + 'waiting for this client to close before activating...');
769
- } else {
770
- logger.warn('The service worker has installed but is waiting ' + 'for existing clients to close before activating...');
771
- }
772
- }
773
- }
774
- }, WAITING_TIMEOUT_DURATION);
775
- } else if (state === 'activating') {
776
- clearTimeout(this._waitingTimeout);
777
-
778
- if (!isExternal) {
779
- this._activeDeferred.resolve(sw);
780
- }
781
- }
782
-
783
- {
784
- switch (state) {
785
- case 'installed':
786
- if (isExternal) {
787
- logger.warn('An external service worker has installed. ' + 'You may want to suggest users reload this page.');
788
- } else {
789
- logger.log('Registered service worker installed.');
790
- }
791
-
792
- break;
793
-
794
- case 'activated':
795
- if (isExternal) {
796
- logger.warn('An external service worker has activated.');
797
- } else {
798
- logger.log('Registered service worker activated.');
799
-
800
- if (sw !== navigator.serviceWorker.controller) {
801
- logger.warn('The registered service worker is active but ' + 'not yet controlling the page. Reload or run ' + '`clients.claim()` in the service worker.');
802
- }
803
- }
804
-
805
- break;
806
-
807
- case 'redundant':
808
- if (sw === this._compatibleControllingSW) {
809
- logger.log('Previously controlling service worker now redundant!');
810
- } else if (!isExternal) {
811
- logger.log('Registered service worker now redundant!');
812
- }
813
-
814
- break;
815
- }
816
- }
817
- };
818
- /**
819
- * @private
820
- * @param {Event} originalEvent
821
- */
822
-
823
-
824
- _proto._onControllerChange = function _onControllerChange(originalEvent) {
825
- var sw = this._sw;
826
-
827
- if (sw === navigator.serviceWorker.controller) {
828
- this.dispatchEvent(new WorkboxEvent('controlling', {
829
- sw: sw,
830
- originalEvent: originalEvent
831
- }));
832
-
833
- {
834
- logger.log('Registered service worker now controlling this page.');
835
- }
836
-
837
- this._controllingDeferred.resolve(sw);
838
- }
839
- };
840
- /**
841
- * @private
842
- * @param {Event} originalEvent
843
- */
844
-
845
-
846
- _proto._onMessage = function _onMessage(originalEvent) {
847
- var data = originalEvent.data;
848
- this.dispatchEvent(new WorkboxEvent('message', {
849
- data: data,
850
- originalEvent: originalEvent
851
- }));
852
- };
853
-
854
- _createClass(Workbox, [{
855
- key: "active",
856
- get: function get() {
857
- return this._activeDeferred.promise;
858
- }
859
- /**
860
- * Resolves to the service worker registered by this instance as soon as it
861
- * is controlling the page. If a service worker was already controlling at
862
- * registration time then it will resolve to that if the script URLs (and
863
- * optionally script versions) match, otherwise it will wait until an update
864
- * is found and starts controlling the page.
865
- * Note: the first time a service worker is installed it will active but
866
- * not start controlling the page unless `clients.claim()` is called in the
867
- * service worker.
868
- *
869
- * @return {Promise<ServiceWorker>}
870
- */
871
-
872
- }, {
873
- key: "controlling",
874
- get: function get() {
875
- return this._controllingDeferred.promise;
876
- }
877
- }]);
878
-
879
- return Workbox;
880
- }(EventTargetShim); // The jsdoc comments below outline the events this instance may dispatch:
881
-
882
- /*
883
- Copyright 2019 Google LLC
884
-
885
- Use of this source code is governed by an MIT-style
886
- license that can be found in the LICENSE file or at
887
- https://opensource.org/licenses/MIT.
888
- */
889
-
890
- exports.Workbox = Workbox;
891
- exports.messageSW = messageSW;
892
-
893
- Object.defineProperty(exports, '__esModule', { value: true });
894
-
895
- }));
896
- //# sourceMappingURL=workbox-window.dev.umd.js.map