jekyll-pwa-workbox 0.0.7.alpha → 5.1.4
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.
- checksums.yaml +4 -4
- data/lib/jekyll-pwa-workbox.rb +4 -4
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-background-sync.dev.js +68 -69
- data/lib/vendor/workbox-v5.1.4/workbox-background-sync.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-background-sync.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-background-sync.prod.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.dev.js +288 -0
- data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-cacheable-response.dev.js +6 -7
- data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-core.dev.js +490 -275
- data/lib/vendor/workbox-v5.1.4/workbox-core.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-core.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-core.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-expiration.dev.js +14 -17
- data/lib/vendor/workbox-v5.1.4/workbox-expiration.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-expiration.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-expiration.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-navigation-preload.dev.js +4 -5
- data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-offline-ga.dev.js +13 -14
- data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-precaching.dev.js +313 -97
- data/lib/vendor/workbox-v5.1.4/workbox-precaching.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-precaching.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-precaching.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-range-requests.dev.js +8 -9
- data/lib/vendor/workbox-v5.1.4/workbox-range-requests.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-range-requests.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-range-requests.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-routing.dev.js +83 -186
- data/lib/vendor/workbox-v5.1.4/workbox-routing.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-routing.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-routing.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-strategies.dev.js +30 -234
- data/lib/vendor/workbox-v5.1.4/workbox-strategies.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-strategies.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-strategies.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-streams.dev.js +16 -31
- data/lib/vendor/workbox-v5.1.4/workbox-streams.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-streams.prod.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-streams.prod.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-sw.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-sw.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-window.dev.es5.mjs +481 -227
- data/lib/vendor/workbox-v5.1.4/workbox-window.dev.es5.mjs.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-window.dev.mjs +246 -46
- data/lib/vendor/workbox-v5.1.4/workbox-window.dev.mjs.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.1.4}/workbox-window.dev.umd.js +483 -229
- data/lib/vendor/workbox-v5.1.4/workbox-window.dev.umd.js.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-window.prod.es5.mjs +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-window.prod.es5.mjs.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-window.prod.mjs +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-window.prod.mjs.map +1 -0
- data/lib/vendor/workbox-v5.1.4/workbox-window.prod.umd.js +2 -0
- data/lib/vendor/workbox-v5.1.4/workbox-window.prod.umd.js.map +1 -0
- metadata +69 -69
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js +0 -486
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.es5.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.umd.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-window.dev.mjs","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../../workbox-core/_private/dontWaitFor.js","../../workbox-core/_private/logger.js","../utils/WorkboxEventTarget.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:5.1.4'] && _();\n}\ncatch (e) { }\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*/\nimport './_version.js';\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 * @memberof module:workbox-window\n */\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.1.4'] && _();\n}\ncatch (e) { }\n","/*\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*/\nimport '../_version.js';\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 */\nclass 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}\nexport { Deferred };\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*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\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*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production' ? null : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in self)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null,\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\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 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 // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\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/**\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 */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\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 * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n 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<ListenerCallback>} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\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*/\nimport '../_version.js';\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 */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\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*/\nimport '../_version.js';\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 */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\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*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\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// 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 * 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 * @memberof module:workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\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 this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\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 const 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 if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\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._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\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 }\n else {\n logger.log('Service worker is installing...');\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 // 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 * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n const eventProps = {\n sw,\n originalEvent\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));\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 = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));\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 }\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 }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\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 }\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 }\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 }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {\n sw,\n originalEvent,\n isUpdate: this._isUpdate,\n }));\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 * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n const { data, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n data,\n sw: source,\n originalEvent,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\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 if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\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 // 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 this._registration = await this._registerScript();\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 this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\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 previous\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 // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(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 // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\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 }\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 const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(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 this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange, { once: true });\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\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 * 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 * 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 !== undefined ? this._sw : this._swDeferred.promise;\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 * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\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 else {\n return undefined;\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(this._scriptURL, this._registerOptions);\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 return reg;\n }\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}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` 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 * 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 * 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|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\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 * 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 * 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 * 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 * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\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 * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\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} 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 * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\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"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","constructor","promise","reject","dontWaitFor","then","logger","process","__WB_DISABLE_DEV_LOGS","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","test","navigator","userAgent","console","styles","logPrefix","join","api","loggerMethods","Object","keys","key","WorkboxEventTarget","_eventListenerRegistry","Map","addEventListener","type","listener","foo","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","has","set","Set","get","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","props","assign","WAITING_TIMEOUT_DURATION","REGISTRATION_TIMEOUT_DURATION","Workbox","scriptURL","registerOptions","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","updateLikelyTriggeredExternally","_scriptURL","performance","now","_externalSW","_sw","serviceWorker","controller","_onStateChange","originalEvent","state","isExternal","eventPrefix","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_compatibleControllingSW","_onControllerChange","_onMessage","source","getSW","register","immediate","document","readyState","res","window","Boolean","_getControllingSWIfCompatible","_registerScript","once","waitingSW","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","update","active","controlling","undefined","reg"],"mappings":"AAEA,IAAI;AACAA,EAAAA,IAAI,CAAC,sBAAD,CAAJ,IAAgCC,CAAC,EAAjC;AACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ACLV;;;;;;;AAOA,AACA;;;;;;;;;;;;;;;AAcA,SAASC,SAAT,CAAmBC,EAAnB,EAAuBC,IAAvB,EAA6B;AACzB,SAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAa;AAC5B,UAAMC,cAAc,GAAG,IAAI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,EAAD,EAAKC,IAAL,CAAhB;AACH;AACD;;;;;;;;;AAOAsH,EAAAA,6BAA6B,GAAG;AAC5B,UAAMzB,UAAU,GAAG9D,SAAS,CAAC6D,aAAV,CAAwBC,UAA3C;;AACA,QAAIA,UAAU,IAAIjC,SAAS,CAACiC,UAAU,CAACrB,SAAZ,EAAuB,KAAKe,UAA5B,CAA3B,EAAoE;AAChE,aAAOM,UAAP;AACH,KAFD,MAGK;AACD,aAAOwC,SAAP;AACH;AACJ;AACD;;;;;;;;AAMA,QAAMd,eAAN,GAAwB;AACpB,QAAI;AACA,YAAMe,GAAG,GAAG,MAAMvG,SAAS,CAAC6D,aAAV,CAAwBmB,QAAxB,CAAiC,KAAKxB,UAAtC,EAAkD,KAAKb,gBAAvD,CAAlB,CADA;AAGA;AACA;;AACA,WAAKK,iBAAL,GAAyBS,WAAW,CAACC,GAAZ,EAAzB;AACA,aAAO6C,GAAP;AACH,KAPD,CAQA,OAAO9G,KAAP,EAAc;AACV,MAA2C;AACvCR,QAAAA,MAAM,CAACQ,KAAP,CAAaA,KAAb;AACH,OAHS;;;AAKV,YAAMA,KAAN;AACH;AACJ;;AA7aoC;AAibzC;;AACA;;;;;;;;;;;;AAWA;;;;;;;;;;;;;;;;;;;;;AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;;;;;;;AAgBA;;;;;;;;;;;;;;;;;AAgBA;;;;;;;;;;;;;;AAaA;;;;;;;;;;;;;;AAaA;;;;;;;;;;;;;;;;"}
|
@@ -2,11 +2,10 @@
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4
4
|
(global = global || self, factory(global.workbox = {}));
|
5
|
-
}(this, function (exports) { 'use strict';
|
5
|
+
}(this, (function (exports) { 'use strict';
|
6
6
|
|
7
|
-
// @ts-ignore
|
8
7
|
try {
|
9
|
-
self['workbox:window:5.
|
8
|
+
self['workbox:window:5.1.4'] && _();
|
10
9
|
} catch (e) {}
|
11
10
|
|
12
11
|
/*
|
@@ -28,7 +27,6 @@
|
|
28
27
|
* @param {ServiceWorker} sw The service worker to send the message to.
|
29
28
|
* @param {Object} data An object to send to the service worker.
|
30
29
|
* @return {Promise<Object|undefined>}
|
31
|
-
*
|
32
30
|
* @memberof module:workbox-window
|
33
31
|
*/
|
34
32
|
|
@@ -66,9 +64,50 @@
|
|
66
64
|
subClass.__proto__ = superClass;
|
67
65
|
}
|
68
66
|
|
69
|
-
|
67
|
+
function _unsupportedIterableToArray(o, minLen) {
|
68
|
+
if (!o) return;
|
69
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
70
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
71
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
72
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
73
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
74
|
+
}
|
75
|
+
|
76
|
+
function _arrayLikeToArray(arr, len) {
|
77
|
+
if (len == null || len > arr.length) len = arr.length;
|
78
|
+
|
79
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
80
|
+
|
81
|
+
return arr2;
|
82
|
+
}
|
83
|
+
|
84
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
85
|
+
var it;
|
86
|
+
|
87
|
+
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
88
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
89
|
+
if (it) o = it;
|
90
|
+
var i = 0;
|
91
|
+
return function () {
|
92
|
+
if (i >= o.length) return {
|
93
|
+
done: true
|
94
|
+
};
|
95
|
+
return {
|
96
|
+
done: false,
|
97
|
+
value: o[i++]
|
98
|
+
};
|
99
|
+
};
|
100
|
+
}
|
101
|
+
|
102
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
103
|
+
}
|
104
|
+
|
105
|
+
it = o[Symbol.iterator]();
|
106
|
+
return it.next.bind(it);
|
107
|
+
}
|
108
|
+
|
70
109
|
try {
|
71
|
-
self['workbox:core:5.
|
110
|
+
self['workbox:core:5.1.4'] && _();
|
72
111
|
} catch (e) {}
|
73
112
|
|
74
113
|
/*
|
@@ -100,6 +139,23 @@
|
|
100
139
|
});
|
101
140
|
};
|
102
141
|
|
142
|
+
/*
|
143
|
+
Copyright 2019 Google LLC
|
144
|
+
Use of this source code is governed by an MIT-style
|
145
|
+
license that can be found in the LICENSE file or at
|
146
|
+
https://opensource.org/licenses/MIT.
|
147
|
+
*/
|
148
|
+
/**
|
149
|
+
* A helper function that prevents a promise from being flagged as unused.
|
150
|
+
*
|
151
|
+
* @private
|
152
|
+
**/
|
153
|
+
|
154
|
+
function dontWaitFor(promise) {
|
155
|
+
// Effective no-op.
|
156
|
+
promise.then(function () {});
|
157
|
+
}
|
158
|
+
|
103
159
|
/*
|
104
160
|
Copyright 2019 Google LLC
|
105
161
|
Use of this source code is governed by an MIT-style
|
@@ -107,6 +163,12 @@
|
|
107
163
|
https://opensource.org/licenses/MIT.
|
108
164
|
*/
|
109
165
|
var logger = function () {
|
166
|
+
// Don't overwrite this value if it's already set.
|
167
|
+
// See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923
|
168
|
+
if (!('__WB_DISABLE_DEV_LOGS' in self)) {
|
169
|
+
self.__WB_DISABLE_DEV_LOGS = false;
|
170
|
+
}
|
171
|
+
|
110
172
|
var inGroup = false;
|
111
173
|
var methodToColorMap = {
|
112
174
|
debug: "#7f8c8d",
|
@@ -120,6 +182,10 @@
|
|
120
182
|
var print = function print(method, args) {
|
121
183
|
var _console2;
|
122
184
|
|
185
|
+
if (self.__WB_DISABLE_DEV_LOGS) {
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
|
123
189
|
if (method === 'groupCollapsed') {
|
124
190
|
// Safari doesn't print all console.groupCollapsed() arguments:
|
125
191
|
// https://bugs.webkit.org/show_bug.cgi?id=182754
|
@@ -151,7 +217,7 @@
|
|
151
217
|
var loggerMethods = Object.keys(methodToColorMap);
|
152
218
|
|
153
219
|
var _loop = function _loop() {
|
154
|
-
var key =
|
220
|
+
var key = _loggerMethods[_i];
|
155
221
|
var method = key;
|
156
222
|
|
157
223
|
api[method] = function () {
|
@@ -163,7 +229,7 @@
|
|
163
229
|
};
|
164
230
|
};
|
165
231
|
|
166
|
-
for (var _i = 0; _i <
|
232
|
+
for (var _i = 0, _loggerMethods = loggerMethods; _i < _loggerMethods.length; _i++) {
|
167
233
|
_loop();
|
168
234
|
}
|
169
235
|
|
@@ -177,18 +243,16 @@
|
|
177
243
|
license that can be found in the LICENSE file or at
|
178
244
|
https://opensource.org/licenses/MIT.
|
179
245
|
*/
|
246
|
+
|
180
247
|
/**
|
181
248
|
* A minimal `EventTarget` shim.
|
182
249
|
* This is necessary because not all browsers support constructable
|
183
250
|
* `EventTarget`, so using a real `EventTarget` will error.
|
184
251
|
* @private
|
185
252
|
*/
|
186
|
-
|
187
|
-
var WorkboxEventTarget =
|
188
|
-
/*#__PURE__*/
|
189
|
-
function () {
|
253
|
+
var WorkboxEventTarget = /*#__PURE__*/function () {
|
190
254
|
function WorkboxEventTarget() {
|
191
|
-
this._eventListenerRegistry =
|
255
|
+
this._eventListenerRegistry = new Map();
|
192
256
|
}
|
193
257
|
/**
|
194
258
|
* @param {string} type
|
@@ -200,45 +264,36 @@
|
|
200
264
|
var _proto = WorkboxEventTarget.prototype;
|
201
265
|
|
202
266
|
_proto.addEventListener = function addEventListener(type, listener) {
|
203
|
-
this._getEventListenersByType(type)
|
204
|
-
|
267
|
+
var foo = this._getEventListenersByType(type);
|
268
|
+
|
269
|
+
foo.add(listener);
|
270
|
+
}
|
205
271
|
/**
|
206
272
|
* @param {string} type
|
207
273
|
* @param {Function} listener
|
208
274
|
* @private
|
209
275
|
*/
|
210
|
-
|
276
|
+
;
|
211
277
|
|
212
278
|
_proto.removeEventListener = function removeEventListener(type, listener) {
|
213
279
|
this._getEventListenersByType(type).delete(listener);
|
214
|
-
}
|
280
|
+
}
|
215
281
|
/**
|
216
282
|
* @param {Object} event
|
217
283
|
* @private
|
218
284
|
*/
|
219
|
-
|
285
|
+
;
|
220
286
|
|
221
287
|
_proto.dispatchEvent = function dispatchEvent(event) {
|
222
288
|
event.target = this;
|
223
289
|
|
224
290
|
var listeners = this._getEventListenersByType(event.type);
|
225
291
|
|
226
|
-
for (var _iterator = listeners,
|
227
|
-
var
|
228
|
-
|
229
|
-
if (_isArray) {
|
230
|
-
if (_i >= _iterator.length) break;
|
231
|
-
_ref = _iterator[_i++];
|
232
|
-
} else {
|
233
|
-
_i = _iterator.next();
|
234
|
-
if (_i.done) break;
|
235
|
-
_ref = _i.value;
|
236
|
-
}
|
237
|
-
|
238
|
-
var listener = _ref;
|
292
|
+
for (var _iterator = _createForOfIteratorHelperLoose(listeners), _step; !(_step = _iterator()).done;) {
|
293
|
+
var listener = _step.value;
|
239
294
|
listener(event);
|
240
295
|
}
|
241
|
-
}
|
296
|
+
}
|
242
297
|
/**
|
243
298
|
* Returns a Set of listeners associated with the passed event type.
|
244
299
|
* If no handlers have been registered, an empty Set is returned.
|
@@ -247,10 +302,14 @@
|
|
247
302
|
* @return {Set<ListenerCallback>} An array of handler functions.
|
248
303
|
* @private
|
249
304
|
*/
|
250
|
-
|
305
|
+
;
|
251
306
|
|
252
307
|
_proto._getEventListenersByType = function _getEventListenersByType(type) {
|
253
|
-
|
308
|
+
if (!this._eventListenerRegistry.has(type)) {
|
309
|
+
this._eventListenerRegistry.set(type, new Set());
|
310
|
+
}
|
311
|
+
|
312
|
+
return this._eventListenerRegistry.get(type);
|
254
313
|
};
|
255
314
|
|
256
315
|
return WorkboxEventTarget;
|
@@ -298,20 +357,24 @@
|
|
298
357
|
Object.assign(this, props);
|
299
358
|
};
|
300
359
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
360
|
+
// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
|
361
|
+
// chosen, but it seems to avoid false positives in my testing.
|
362
|
+
|
363
|
+
function _await(value, then, direct) {
|
364
|
+
if (direct) {
|
365
|
+
return then ? then(value) : value;
|
306
366
|
}
|
307
367
|
|
308
|
-
if (
|
309
|
-
|
368
|
+
if (!value || !value.then) {
|
369
|
+
value = Promise.resolve(value);
|
310
370
|
}
|
311
371
|
|
312
|
-
return
|
372
|
+
return then ? value.then(then) : value;
|
313
373
|
}
|
314
374
|
|
375
|
+
var WAITING_TIMEOUT_DURATION = 200; // The amount of time after a registration that we can reasonably conclude
|
376
|
+
// that the registration didn't trigger an update.
|
377
|
+
|
315
378
|
function _async(f) {
|
316
379
|
return function () {
|
317
380
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
@@ -326,41 +389,6 @@
|
|
326
389
|
};
|
327
390
|
}
|
328
391
|
|
329
|
-
function _invoke(body, then) {
|
330
|
-
var result = body();
|
331
|
-
|
332
|
-
if (result && result.then) {
|
333
|
-
return result.then(then);
|
334
|
-
}
|
335
|
-
|
336
|
-
return then(result);
|
337
|
-
}
|
338
|
-
|
339
|
-
function _await(value, then, direct) {
|
340
|
-
if (direct) {
|
341
|
-
return then ? then(value) : value;
|
342
|
-
}
|
343
|
-
|
344
|
-
if (!value || !value.then) {
|
345
|
-
value = Promise.resolve(value);
|
346
|
-
}
|
347
|
-
|
348
|
-
return then ? value.then(then) : value;
|
349
|
-
}
|
350
|
-
|
351
|
-
function _awaitIgnored(value, direct) {
|
352
|
-
if (!direct) {
|
353
|
-
return value && value.then ? value.then(_empty) : Promise.resolve();
|
354
|
-
}
|
355
|
-
}
|
356
|
-
|
357
|
-
function _empty() {}
|
358
|
-
// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
|
359
|
-
// chosen, but it seems to avoid false positives in my testing.
|
360
|
-
|
361
|
-
var WAITING_TIMEOUT_DURATION = 200; // The amount of time after a registration that we can reasonably conclude
|
362
|
-
// that the registration didn't trigger an update.
|
363
|
-
|
364
392
|
var REGISTRATION_TIMEOUT_DURATION = 60000;
|
365
393
|
/**
|
366
394
|
* A class to aid in handling service worker registration, updates, and
|
@@ -375,13 +403,12 @@
|
|
375
403
|
* @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}
|
376
404
|
* @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}
|
377
405
|
* @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}
|
378
|
-
*
|
379
406
|
* @memberof module:workbox-window
|
380
407
|
*/
|
381
408
|
|
382
|
-
|
383
|
-
|
384
|
-
function (_WorkboxEventTarget) {
|
409
|
+
function _empty() {}
|
410
|
+
|
411
|
+
var Workbox = /*#__PURE__*/function (_WorkboxEventTarget) {
|
385
412
|
_inheritsLoose(Workbox, _WorkboxEventTarget);
|
386
413
|
|
387
414
|
/**
|
@@ -410,6 +437,7 @@
|
|
410
437
|
_this._activeDeferred = new Deferred();
|
411
438
|
_this._controllingDeferred = new Deferred();
|
412
439
|
_this._registrationTime = 0;
|
440
|
+
_this._ownSWs = new Set();
|
413
441
|
/**
|
414
442
|
* @private
|
415
443
|
*/
|
@@ -452,6 +480,8 @@
|
|
452
480
|
// SW is the one we registered, so we set it.
|
453
481
|
_this._sw = installingSW;
|
454
482
|
|
483
|
+
_this._ownSWs.add(installingSW);
|
484
|
+
|
455
485
|
_this._swDeferred.resolve(installingSW); // The `installing` state isn't something we have a dedicated
|
456
486
|
// callback for, but we do log messages for it in development.
|
457
487
|
|
@@ -591,17 +621,32 @@
|
|
591
621
|
*/
|
592
622
|
|
593
623
|
|
594
|
-
_this._onMessage = function (originalEvent) {
|
595
|
-
var data = originalEvent.data
|
596
|
-
|
597
|
-
|
598
|
-
data: data,
|
599
|
-
originalEvent: originalEvent
|
600
|
-
}));
|
601
|
-
};
|
624
|
+
_this._onMessage = _async(function (originalEvent) {
|
625
|
+
var data = originalEvent.data,
|
626
|
+
source = originalEvent.source; // Wait until there's an "own" service worker. This is used to buffer
|
627
|
+
// `message` events that may be received prior to calling `register()`.
|
602
628
|
|
629
|
+
return _await(_this.getSW(), function () {
|
630
|
+
if (_this._ownSWs.has(source)) {
|
631
|
+
_this.dispatchEvent(new WorkboxEvent('message', {
|
632
|
+
data: data,
|
633
|
+
sw: source,
|
634
|
+
originalEvent: originalEvent
|
635
|
+
}));
|
636
|
+
}
|
637
|
+
}); // If the service worker that sent the message is in the list of own
|
638
|
+
// service workers for this instance, dispatch a `message` event.
|
639
|
+
// NOTE: we check for all previously owned service workers rather than
|
640
|
+
// just the current one because some messages (e.g. cache updates) use
|
641
|
+
// a timeout when sent and may be delayed long enough for a service worker
|
642
|
+
// update to be found.
|
643
|
+
});
|
603
644
|
_this._scriptURL = scriptURL;
|
604
|
-
_this._registerOptions = registerOptions;
|
645
|
+
_this._registerOptions = registerOptions; // Add a message listener immediately since messages received during
|
646
|
+
// page load are buffered only until the DOMContentLoaded event:
|
647
|
+
// https://github.com/GoogleChrome/workbox/issues/2202
|
648
|
+
|
649
|
+
navigator.serviceWorker.addEventListener('message', _this._onMessage);
|
605
650
|
return _this;
|
606
651
|
}
|
607
652
|
/**
|
@@ -617,122 +662,142 @@
|
|
617
662
|
|
618
663
|
|
619
664
|
var _proto = Workbox.prototype;
|
620
|
-
_proto.register = _async(function (_temp) {
|
621
|
-
var _this2 = this;
|
622
665
|
|
666
|
+
_proto.register = function register(_temp) {
|
623
667
|
var _ref = _temp === void 0 ? {} : _temp,
|
624
668
|
_ref$immediate = _ref.immediate,
|
625
669
|
immediate = _ref$immediate === void 0 ? false : _ref$immediate;
|
626
670
|
|
627
|
-
{
|
628
|
-
|
629
|
-
logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
|
630
|
-
return;
|
631
|
-
}
|
632
|
-
}
|
671
|
+
try {
|
672
|
+
var _this3 = this;
|
633
673
|
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
return
|
638
|
-
}
|
674
|
+
if ("dev" !== 'production') {
|
675
|
+
if (_this3._registrationTime) {
|
676
|
+
logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
|
677
|
+
return;
|
678
|
+
}
|
639
679
|
}
|
640
|
-
}, function () {
|
641
|
-
// Set this flag to true if any service worker was controlling the page
|
642
|
-
// at registration time.
|
643
|
-
_this2._isUpdate = Boolean(navigator.serviceWorker.controller); // Before registering, attempt to determine if a SW is already controlling
|
644
|
-
// the page, and if that SW script (and version, if specified) matches this
|
645
|
-
// instance's script.
|
646
|
-
|
647
|
-
_this2._compatibleControllingSW = _this2._getControllingSWIfCompatible();
|
648
|
-
return _await(_this2._registerScript(), function (_this2$_registerScrip) {
|
649
|
-
_this2._registration = _this2$_registerScrip;
|
650
|
-
|
651
|
-
// If we have a compatible controller, store the controller as the "own"
|
652
|
-
// SW, resolve active/controlling deferreds and add necessary listeners.
|
653
|
-
if (_this2._compatibleControllingSW) {
|
654
|
-
_this2._sw = _this2._compatibleControllingSW;
|
655
|
-
|
656
|
-
_this2._activeDeferred.resolve(_this2._compatibleControllingSW);
|
657
|
-
|
658
|
-
_this2._controllingDeferred.resolve(_this2._compatibleControllingSW);
|
659
|
-
|
660
|
-
_this2._reportWindowReady(_this2._compatibleControllingSW);
|
661
680
|
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
//
|
681
|
+
return _invoke(function () {
|
682
|
+
if (!immediate && document.readyState !== 'complete') {
|
683
|
+
return _awaitIgnored(new Promise(function (res) {
|
684
|
+
return window.addEventListener('load', res);
|
685
|
+
}));
|
686
|
+
}
|
687
|
+
}, function () {
|
688
|
+
// Set this flag to true if any service worker was controlling the page
|
689
|
+
// at registration time.
|
690
|
+
_this3._isUpdate = Boolean(navigator.serviceWorker.controller); // Before registering, attempt to determine if a SW is already controlling
|
691
|
+
// the page, and if that SW script (and version, if specified) matches this
|
692
|
+
// instance's script.
|
693
|
+
|
694
|
+
_this3._compatibleControllingSW = _this3._getControllingSWIfCompatible();
|
695
|
+
return _await(_this3._registerScript(), function (_this2$_registerScrip) {
|
696
|
+
_this3._registration = _this2$_registerScrip;
|
697
|
+
|
698
|
+
// If we have a compatible controller, store the controller as the "own"
|
699
|
+
// SW, resolve active/controlling deferreds and add necessary listeners.
|
700
|
+
if (_this3._compatibleControllingSW) {
|
701
|
+
_this3._sw = _this3._compatibleControllingSW;
|
702
|
+
|
703
|
+
_this3._activeDeferred.resolve(_this3._compatibleControllingSW);
|
704
|
+
|
705
|
+
_this3._controllingDeferred.resolve(_this3._compatibleControllingSW);
|
706
|
+
|
707
|
+
_this3._compatibleControllingSW.addEventListener('statechange', _this3._onStateChange, {
|
708
|
+
once: true
|
709
|
+
});
|
710
|
+
} // If there's a waiting service worker with a matching URL before the
|
711
|
+
// `updatefound` event fires, it likely means that this site is open
|
712
|
+
// in another tab, or the user refreshed the page (and thus the previous
|
713
|
+
// page wasn't fully unloaded before this page started loading).
|
714
|
+
// https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
|
715
|
+
|
716
|
+
|
717
|
+
var waitingSW = _this3._registration.waiting;
|
718
|
+
|
719
|
+
if (waitingSW && urlsMatch(waitingSW.scriptURL, _this3._scriptURL)) {
|
720
|
+
// Store the waiting SW as the "own" Sw, even if it means overwriting
|
721
|
+
// a compatible controller.
|
722
|
+
_this3._sw = waitingSW; // Run this in the next microtask, so any code that adds an event
|
723
|
+
// listener after awaiting `register()` will get this event.
|
724
|
+
|
725
|
+
dontWaitFor(Promise.resolve().then(function () {
|
726
|
+
_this3.dispatchEvent(new WorkboxEvent('waiting', {
|
727
|
+
sw: waitingSW,
|
728
|
+
wasWaitingBeforeRegister: true
|
729
|
+
}));
|
730
|
+
|
731
|
+
if ("dev" !== 'production') {
|
732
|
+
logger.warn('A service worker was already waiting to activate ' + 'before this script was registered...');
|
733
|
+
}
|
734
|
+
}));
|
735
|
+
} // If an "own" SW is already set, resolve the deferred.
|
670
736
|
|
671
737
|
|
672
|
-
|
738
|
+
if (_this3._sw) {
|
739
|
+
_this3._swDeferred.resolve(_this3._sw);
|
673
740
|
|
674
|
-
|
675
|
-
|
676
|
-
// a compatible controller.
|
677
|
-
_this2._sw = waitingSW; // Run this in the next microtask, so any code that adds an event
|
678
|
-
// listener after awaiting `register()` will get this event.
|
741
|
+
_this3._ownSWs.add(_this3._sw);
|
742
|
+
}
|
679
743
|
|
680
|
-
|
681
|
-
|
682
|
-
sw: waitingSW,
|
683
|
-
wasWaitingBeforeRegister: true
|
684
|
-
}));
|
744
|
+
if ("dev" !== 'production') {
|
745
|
+
logger.log('Successfully registered service worker.', _this3._scriptURL);
|
685
746
|
|
686
|
-
{
|
687
|
-
|
747
|
+
if (navigator.serviceWorker.controller) {
|
748
|
+
if (_this3._compatibleControllingSW) {
|
749
|
+
logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
|
750
|
+
} else {
|
751
|
+
logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
|
752
|
+
}
|
688
753
|
}
|
689
|
-
});
|
690
|
-
} // If an "own" SW is already set, resolve the deferred.
|
691
754
|
|
755
|
+
var currentPageIsOutOfScope = function currentPageIsOutOfScope() {
|
756
|
+
var scopeURL = new URL(_this3._registerOptions.scope || _this3._scriptURL, document.baseURI);
|
757
|
+
var scopeURLBasePath = new URL('./', scopeURL.href).pathname;
|
758
|
+
return !location.pathname.startsWith(scopeURLBasePath);
|
759
|
+
};
|
692
760
|
|
693
|
-
|
694
|
-
|
695
|
-
}
|
696
|
-
|
697
|
-
{
|
698
|
-
logger.log('Successfully registered service worker.', _this2._scriptURL);
|
699
|
-
|
700
|
-
if (navigator.serviceWorker.controller) {
|
701
|
-
if (_this2._compatibleControllingSW) {
|
702
|
-
logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
|
703
|
-
} else {
|
704
|
-
logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
|
761
|
+
if (currentPageIsOutOfScope()) {
|
762
|
+
logger.warn('The current page is not in scope for the registered ' + 'service worker. Was this a mistake?');
|
705
763
|
}
|
706
764
|
}
|
707
765
|
|
708
|
-
|
709
|
-
var scopeURL = new URL(_this2._registerOptions.scope || _this2._scriptURL, document.baseURI);
|
710
|
-
var scopeURLBasePath = new URL('./', scopeURL.href).pathname;
|
711
|
-
return !location.pathname.startsWith(scopeURLBasePath);
|
712
|
-
};
|
766
|
+
_this3._registration.addEventListener('updatefound', _this3._onUpdateFound);
|
713
767
|
|
714
|
-
|
715
|
-
|
716
|
-
}
|
717
|
-
|
768
|
+
navigator.serviceWorker.addEventListener('controllerchange', _this3._onControllerChange, {
|
769
|
+
once: true
|
770
|
+
});
|
771
|
+
return _this3._registration;
|
772
|
+
});
|
773
|
+
});
|
774
|
+
} catch (e) {
|
775
|
+
return Promise.reject(e);
|
776
|
+
}
|
777
|
+
}
|
778
|
+
/**
|
779
|
+
* Checks for updates of the registered service worker.
|
780
|
+
*/
|
781
|
+
;
|
718
782
|
|
719
|
-
|
783
|
+
_proto.update = function update() {
|
784
|
+
try {
|
785
|
+
var _this5 = this;
|
720
786
|
|
721
|
-
|
722
|
-
|
723
|
-
|
787
|
+
if (!_this5._registration) {
|
788
|
+
if ("dev" !== 'production') {
|
789
|
+
logger.error('Cannot update a Workbox instance without ' + 'being registered. Register the Workbox instance first.');
|
790
|
+
}
|
724
791
|
|
725
|
-
|
726
|
-
|
792
|
+
return;
|
793
|
+
} // Try to update registration
|
727
794
|
|
728
|
-
_this2._broadcastChannel.addEventListener('message', _this2._onMessage);
|
729
|
-
}
|
730
795
|
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
}
|
735
|
-
}
|
796
|
+
return _awaitIgnored(_this5._registration.update());
|
797
|
+
} catch (e) {
|
798
|
+
return Promise.reject(e);
|
799
|
+
}
|
800
|
+
}
|
736
801
|
/**
|
737
802
|
* Resolves to the service worker registered by this instance as soon as it
|
738
803
|
* is active. If a service worker was already controlling at registration
|
@@ -742,6 +807,7 @@
|
|
742
807
|
*
|
743
808
|
* @return {Promise<ServiceWorker>}
|
744
809
|
*/
|
810
|
+
;
|
745
811
|
|
746
812
|
/**
|
747
813
|
* Resolves with a reference to a service worker that matches the script URL
|
@@ -758,13 +824,17 @@
|
|
758
824
|
*
|
759
825
|
* @return {Promise<ServiceWorker>}
|
760
826
|
*/
|
761
|
-
_proto.getSW =
|
762
|
-
|
827
|
+
_proto.getSW = function getSW() {
|
828
|
+
try {
|
829
|
+
var _this7 = this;
|
763
830
|
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
831
|
+
// If `this._sw` is set, resolve with that as we want `getSW()` to
|
832
|
+
// return the correct (new) service worker if an update is found.
|
833
|
+
return _this7._sw !== undefined ? _this7._sw : _this7._swDeferred.promise;
|
834
|
+
} catch (e) {
|
835
|
+
return Promise.reject(e);
|
836
|
+
}
|
837
|
+
}
|
768
838
|
/**
|
769
839
|
* Sends the passed data object to the service worker registered by this
|
770
840
|
* instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves
|
@@ -778,21 +848,27 @@
|
|
778
848
|
* @param {Object} data An object to send to the service worker
|
779
849
|
* @return {Promise<Object>}
|
780
850
|
*/
|
851
|
+
;
|
781
852
|
|
782
|
-
_proto.messageSW =
|
783
|
-
|
853
|
+
_proto.messageSW = function messageSW$1(data) {
|
854
|
+
try {
|
855
|
+
var _this9 = this;
|
784
856
|
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
857
|
+
return _await(_this9.getSW(), function (sw) {
|
858
|
+
return messageSW(sw, data);
|
859
|
+
});
|
860
|
+
} catch (e) {
|
861
|
+
return Promise.reject(e);
|
862
|
+
}
|
863
|
+
}
|
789
864
|
/**
|
790
865
|
* Checks for a service worker already controlling the page and returns
|
791
|
-
* it if its script URL
|
866
|
+
* it if its script URL matches.
|
792
867
|
*
|
793
868
|
* @private
|
794
869
|
* @return {ServiceWorker|undefined}
|
795
870
|
*/
|
871
|
+
;
|
796
872
|
|
797
873
|
_proto._getControllingSWIfCompatible = function _getControllingSWIfCompatible() {
|
798
874
|
var controller = navigator.serviceWorker.controller;
|
@@ -802,47 +878,38 @@
|
|
802
878
|
} else {
|
803
879
|
return undefined;
|
804
880
|
}
|
805
|
-
}
|
881
|
+
}
|
806
882
|
/**
|
807
883
|
* Registers a service worker for this instances script URL and register
|
808
884
|
* options and tracks the time registration was complete.
|
809
885
|
*
|
810
886
|
* @private
|
811
887
|
*/
|
888
|
+
;
|
812
889
|
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
890
|
+
_proto._registerScript = function _registerScript() {
|
891
|
+
try {
|
892
|
+
var _this11 = this;
|
893
|
+
|
894
|
+
return _catch(function () {
|
895
|
+
return _await(navigator.serviceWorker.register(_this11._scriptURL, _this11._registerOptions), function (reg) {
|
896
|
+
// Keep track of when registration happened, so it can be used in the
|
897
|
+
// `this._onUpdateFound` heuristic. Also use the presence of this
|
898
|
+
// property as a way to see if `.register()` has been called.
|
899
|
+
_this11._registrationTime = performance.now();
|
900
|
+
return reg;
|
901
|
+
});
|
902
|
+
}, function (error) {
|
903
|
+
if ("dev" !== 'production') {
|
904
|
+
logger.error(error);
|
905
|
+
} // Re-throw the error.
|
906
|
+
|
907
|
+
|
908
|
+
throw error;
|
824
909
|
});
|
825
|
-
}
|
826
|
-
|
827
|
-
|
828
|
-
} // Re-throw the error.
|
829
|
-
|
830
|
-
|
831
|
-
throw error;
|
832
|
-
});
|
833
|
-
});
|
834
|
-
/**
|
835
|
-
* Sends a message to the passed service worker that the window is ready.
|
836
|
-
*
|
837
|
-
* @param {ServiceWorker} sw
|
838
|
-
* @private
|
839
|
-
*/
|
840
|
-
|
841
|
-
_proto._reportWindowReady = function _reportWindowReady(sw) {
|
842
|
-
messageSW(sw, {
|
843
|
-
type: 'WINDOW_READY',
|
844
|
-
meta: 'workbox-window'
|
845
|
-
});
|
910
|
+
} catch (e) {
|
911
|
+
return Promise.reject(e);
|
912
|
+
}
|
846
913
|
};
|
847
914
|
|
848
915
|
_createClass(Workbox, [{
|
@@ -871,12 +938,199 @@
|
|
871
938
|
}]);
|
872
939
|
|
873
940
|
return Workbox;
|
874
|
-
}(WorkboxEventTarget);
|
941
|
+
}(WorkboxEventTarget);
|
942
|
+
|
943
|
+
function _awaitIgnored(value, direct) {
|
944
|
+
if (!direct) {
|
945
|
+
return value && value.then ? value.then(_empty) : Promise.resolve();
|
946
|
+
}
|
947
|
+
} // The jsdoc comments below outline the events this instance may dispatch:
|
948
|
+
// -----------------------------------------------------------------------
|
949
|
+
|
950
|
+
/**
|
951
|
+
* The `message` event is dispatched any time a `postMessage` is received.
|
952
|
+
*
|
953
|
+
* @event module:workbox-window.Workbox#message
|
954
|
+
* @type {WorkboxEvent}
|
955
|
+
* @property {*} data The `data` property from the original `message` event.
|
956
|
+
* @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
|
957
|
+
* event.
|
958
|
+
* @property {string} type `message`.
|
959
|
+
* @property {Workbox} target The `Workbox` instance.
|
960
|
+
*/
|
961
|
+
|
962
|
+
/**
|
963
|
+
* The `installed` event is dispatched if the state of a
|
964
|
+
* [`Workbox`]{@link module:workbox-window.Workbox} instance's
|
965
|
+
* [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
|
966
|
+
* changes to `installed`.
|
967
|
+
*
|
968
|
+
* Then can happen either the very first time a service worker is installed,
|
969
|
+
* or after an update to the current service worker is found. In the case
|
970
|
+
* of an update being found, the event's `isUpdate` property will be `true`.
|
971
|
+
*
|
972
|
+
* @event module:workbox-window.Workbox#installed
|
973
|
+
* @type {WorkboxEvent}
|
974
|
+
* @property {ServiceWorker} sw The service worker instance.
|
975
|
+
* @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
976
|
+
* event.
|
977
|
+
* @property {boolean|undefined} isUpdate True if a service worker was already
|
978
|
+
* controlling when this `Workbox` instance called `register()`.
|
979
|
+
* @property {string} type `installed`.
|
980
|
+
* @property {Workbox} target The `Workbox` instance.
|
981
|
+
*/
|
982
|
+
|
983
|
+
/**
|
984
|
+
* The `waiting` event is dispatched if the state of a
|
985
|
+
* [`Workbox`]{@link module:workbox-window.Workbox} instance's
|
986
|
+
* [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
|
987
|
+
* changes to `installed` and then doesn't immediately change to `activating`.
|
988
|
+
* It may also be dispatched if a service worker with the same
|
989
|
+
* [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
|
990
|
+
* was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}
|
991
|
+
* method was called.
|
992
|
+
*
|
993
|
+
* @event module:workbox-window.Workbox#waiting
|
994
|
+
* @type {WorkboxEvent}
|
995
|
+
* @property {ServiceWorker} sw The service worker instance.
|
996
|
+
* @property {Event|undefined} originalEvent The original
|
997
|
+
* [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
998
|
+
* event, or `undefined` in the case where the service worker was waiting
|
999
|
+
* to before `.register()` was called.
|
1000
|
+
* @property {boolean|undefined} isUpdate True if a service worker was already
|
1001
|
+
* controlling when this `Workbox` instance called `register()`.
|
1002
|
+
* @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
|
1003
|
+
* a matching `scriptURL` was already waiting when this `Workbox`
|
1004
|
+
* instance called `register()`.
|
1005
|
+
* @property {string} type `waiting`.
|
1006
|
+
* @property {Workbox} target The `Workbox` instance.
|
1007
|
+
*/
|
1008
|
+
|
1009
|
+
/**
|
1010
|
+
* The `controlling` event is dispatched if a
|
1011
|
+
* [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
|
1012
|
+
* fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
|
1013
|
+
* and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
|
1014
|
+
* of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
|
1015
|
+
* matches the `scriptURL` of the `Workbox` instance's
|
1016
|
+
* [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
|
1017
|
+
*
|
1018
|
+
* @event module:workbox-window.Workbox#controlling
|
1019
|
+
* @type {WorkboxEvent}
|
1020
|
+
* @property {ServiceWorker} sw The service worker instance.
|
1021
|
+
* @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
|
1022
|
+
* event.
|
1023
|
+
* @property {boolean|undefined} isUpdate True if a service worker was already
|
1024
|
+
* controlling when this service worker was registered.
|
1025
|
+
* @property {string} type `controlling`.
|
1026
|
+
* @property {Workbox} target The `Workbox` instance.
|
1027
|
+
*/
|
1028
|
+
|
1029
|
+
/**
|
1030
|
+
* The `activated` event is dispatched if the state of a
|
1031
|
+
* [`Workbox`]{@link module:workbox-window.Workbox} instance's
|
1032
|
+
* [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
|
1033
|
+
* changes to `activated`.
|
1034
|
+
*
|
1035
|
+
* @event module:workbox-window.Workbox#activated
|
1036
|
+
* @type {WorkboxEvent}
|
1037
|
+
* @property {ServiceWorker} sw The service worker instance.
|
1038
|
+
* @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
1039
|
+
* event.
|
1040
|
+
* @property {boolean|undefined} isUpdate True if a service worker was already
|
1041
|
+
* controlling when this `Workbox` instance called `register()`.
|
1042
|
+
* @property {string} type `activated`.
|
1043
|
+
* @property {Workbox} target The `Workbox` instance.
|
1044
|
+
*/
|
1045
|
+
|
1046
|
+
/**
|
1047
|
+
* The `redundant` event is dispatched if the state of a
|
1048
|
+
* [`Workbox`]{@link module:workbox-window.Workbox} instance's
|
1049
|
+
* [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
|
1050
|
+
* changes to `redundant`.
|
1051
|
+
*
|
1052
|
+
* @event module:workbox-window.Workbox#redundant
|
1053
|
+
* @type {WorkboxEvent}
|
1054
|
+
* @property {ServiceWorker} sw The service worker instance.
|
1055
|
+
* @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
1056
|
+
* event.
|
1057
|
+
* @property {boolean|undefined} isUpdate True if a service worker was already
|
1058
|
+
* controlling when this `Workbox` instance called `register()`.
|
1059
|
+
* @property {string} type `redundant`.
|
1060
|
+
* @property {Workbox} target The `Workbox` instance.
|
1061
|
+
*/
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
* The `externalinstalled` event is dispatched if the state of an
|
1065
|
+
* [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}
|
1066
|
+
* changes to `installed`.
|
1067
|
+
*
|
1068
|
+
* @event module:workbox-window.Workbox#externalinstalled
|
1069
|
+
* @type {WorkboxEvent}
|
1070
|
+
* @property {ServiceWorker} sw The service worker instance.
|
1071
|
+
* @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
1072
|
+
* event.
|
1073
|
+
* @property {string} type `externalinstalled`.
|
1074
|
+
* @property {Workbox} target The `Workbox` instance.
|
1075
|
+
*/
|
1076
|
+
|
1077
|
+
/**
|
1078
|
+
* The `externalwaiting` event is dispatched if the state of an
|
1079
|
+
* [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}
|
1080
|
+
* changes to `waiting`.
|
1081
|
+
*
|
1082
|
+
* @event module:workbox-window.Workbox#externalwaiting
|
1083
|
+
* @type {WorkboxEvent}
|
1084
|
+
* @property {ServiceWorker} sw The service worker instance.
|
1085
|
+
* @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
1086
|
+
* event.
|
1087
|
+
* @property {string} type `externalwaiting`.
|
1088
|
+
* @property {Workbox} target The `Workbox` instance.
|
1089
|
+
*/
|
1090
|
+
|
1091
|
+
/**
|
1092
|
+
* The `externalactivated` event is dispatched if the state of an
|
1093
|
+
* [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}
|
1094
|
+
* changes to `activated`.
|
1095
|
+
*
|
1096
|
+
* @event module:workbox-window.Workbox#externalactivated
|
1097
|
+
* @type {WorkboxEvent}
|
1098
|
+
* @property {ServiceWorker} sw The service worker instance.
|
1099
|
+
* @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
|
1100
|
+
* event.
|
1101
|
+
* @property {string} type `externalactivated`.
|
1102
|
+
* @property {Workbox} target The `Workbox` instance.
|
1103
|
+
*/
|
1104
|
+
|
1105
|
+
|
1106
|
+
function _invoke(body, then) {
|
1107
|
+
var result = body();
|
1108
|
+
|
1109
|
+
if (result && result.then) {
|
1110
|
+
return result.then(then);
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
return then(result);
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
function _catch(body, recover) {
|
1117
|
+
try {
|
1118
|
+
var result = body();
|
1119
|
+
} catch (e) {
|
1120
|
+
return recover(e);
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
if (result && result.then) {
|
1124
|
+
return result.then(void 0, recover);
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
return result;
|
1128
|
+
}
|
875
1129
|
|
876
1130
|
exports.Workbox = Workbox;
|
877
1131
|
exports.messageSW = messageSW;
|
878
1132
|
|
879
1133
|
Object.defineProperty(exports, '__esModule', { value: true });
|
880
1134
|
|
881
|
-
}));
|
1135
|
+
})));
|
882
1136
|
//# sourceMappingURL=workbox-window.dev.umd.js.map
|