workbox-window
Advanced tools
Comparing version 5.0.0-beta.1 to 5.0.0-rc.0
@@ -0,5 +1,6 @@ | ||
"use strict"; | ||
// @ts-ignore | ||
try { | ||
self['workbox:window:5.0.0-beta.1'] && _(); | ||
self['workbox:window:5.0.0-rc.0'] && _(); | ||
} | ||
catch (e) { } |
@@ -7,5 +7,4 @@ (function (global, factory) { | ||
// @ts-ignore | ||
try { | ||
self['workbox:window:5.0.0-beta.1'] && _(); | ||
self['workbox:window:5.0.0-rc.0'] && _(); | ||
} catch (e) {} | ||
@@ -70,5 +69,4 @@ | ||
// @ts-ignore | ||
try { | ||
self['workbox:core:5.0.0-beta.1'] && _(); | ||
self['workbox:core:5.0.0-rc.0'] && _(); | ||
} catch (e) {} | ||
@@ -111,2 +109,19 @@ | ||
*/ | ||
/** | ||
* A helper function that prevents a promise from being flagged as unused. | ||
* | ||
* @private | ||
**/ | ||
function dontWaitFor(promise) { | ||
// Effective no-op. | ||
promise.then(function () {}); | ||
} | ||
/* | ||
Copyright 2019 Google LLC | ||
Use of this source code is governed by an MIT-style | ||
license that can be found in the LICENSE file or at | ||
https://opensource.org/licenses/MIT. | ||
*/ | ||
var logger = function () { | ||
@@ -676,3 +691,3 @@ var inGroup = false; | ||
Promise.resolve().then(function () { | ||
dontWaitFor(Promise.resolve().then(function () { | ||
_this2.dispatchEvent(new WorkboxEvent('waiting', { | ||
@@ -686,3 +701,3 @@ sw: waitingSW, | ||
} | ||
}); | ||
})); | ||
} // If an "own" SW is already set, resolve the deferred. | ||
@@ -689,0 +704,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).workbox={})}(this,function(n){"use strict";try{self["workbox:window:5.0.0-beta.1"]&&_()}catch(n){}function t(n,t){return new Promise(function(e){var r=new MessageChannel;r.port1.onmessage=function(n){e(n.data)},n.postMessage(t,[r.port2])})}function e(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}try{self["workbox:core:5.0.0-beta.1"]&&_()}catch(n){}var r=function(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})};function i(n,t){var e=location.href;return new URL(n,e).href===new URL(t,e).href}var o=function(n,t){this.type=n,Object.assign(this,t)};function u(n,t,e){return e?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}var a=200;function c(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return Promise.resolve(n.apply(this,t))}catch(n){return Promise.reject(n)}}}var f=6e4;function s(){}var v=function(n){var s,v;function l(t,e){var s;return void 0===e&&(e={}),(s=n.call(this)||this).t={},s.i=0,s.o=new r,s.u=new r,s.s=new r,s.v=0,s.h=new Set,s.l=function(){var n=s.g,t=n.installing;s.i>0||!i(t.scriptURL,s.m)||performance.now()>s.v+f?(s.p=t,n.removeEventListener("updatefound",s.l)):(s.P=t,s.h.add(t),s.o.resolve(t)),++s.i,t.addEventListener("statechange",s.j)},s.j=function(n){var t=s.g,e=n.target,r=e.state,i=e===s.p,u=i?"external":"",c={sw:e,originalEvent:n};!i&&s.k&&(c.isUpdate=!0),s.dispatchEvent(new o(u+r,c)),"installed"===r?s.O=self.setTimeout(function(){"installed"===r&&t.waiting===e&&s.dispatchEvent(new o(u+"waiting",c))},a):"activating"===r&&(clearTimeout(s.O),i||s.u.resolve(e))},s._=function(n){var t=s.P;t===navigator.serviceWorker.controller&&(s.dispatchEvent(new o("controlling",{sw:t,originalEvent:n,isUpdate:s.k})),s.s.resolve(t))},s.L=c(function(n){var t=n.data,e=n.source;return u(s.getSW(),function(){s.h.has(e)&&s.dispatchEvent(new o("message",{data:t,sw:e,originalEvent:n}))})}),s.m=t,s.t=e,navigator.serviceWorker.addEventListener("message",s.L),s}v=n,(s=l).prototype=Object.create(v.prototype),s.prototype.constructor=s,s.__proto__=v;var d,w,g,m=l.prototype;return m.register=c(function(n){var t=this,e=(void 0===n?{}:n).immediate,r=void 0!==e&&e;return function(n,t){var e=n();if(e&&e.then)return e.then(t);return t(e)}(function(){if(!r&&"complete"!==document.readyState)return h(new Promise(function(n){return addEventListener("load",n)}))},function(){return t.k=Boolean(navigator.serviceWorker.controller),t.M=t.R(),u(t.S(),function(n){t.g=n,t.M&&(t.P=t.M,t.u.resolve(t.M),t.s.resolve(t.M),t.M.addEventListener("statechange",t.j,{once:!0}));var e=t.g.waiting;return e&&i(e.scriptURL,t.m)&&(t.P=e,Promise.resolve().then(function(){t.dispatchEvent(new o("waiting",{sw:e,wasWaitingBeforeRegister:!0}))})),t.P&&(t.o.resolve(t.P),t.h.add(t.P)),t.g.addEventListener("updatefound",t.l),navigator.serviceWorker.addEventListener("controllerchange",t._,{once:!0}),t.g})})}),m.update=c(function(){if(this.g)return h(this.g.update())}),m.getSW=c(function(){return void 0!==this.P?this.P:this.o.promise}),m.messageSW=c(function(n){return u(this.getSW(),function(e){return t(e,n)})}),m.R=function(){var n=navigator.serviceWorker.controller;return n&&i(n.scriptURL,this.m)?n:void 0},m.S=c(function(){var n=this;return function(n,t){try{var e=n()}catch(n){return t(n)}if(e&&e.then)return e.then(void 0,t);return e}(function(){return u(navigator.serviceWorker.register(n.m,n.t),function(t){return n.v=performance.now(),t})},function(n){throw n})}),d=l,(w=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&e(d.prototype,w),g&&e(d,g),l}(function(){function n(){this.U=new Map}var t=n.prototype;return t.addEventListener=function(n,t){this.B(n).add(t)},t.removeEventListener=function(n,t){this.B(n).delete(t)},t.dispatchEvent=function(n){n.target=this;var t=this.B(n.type),e=Array.isArray(t),r=0;for(t=e?t:t[Symbol.iterator]();;){var i;if(e){if(r>=t.length)break;i=t[r++]}else{if((r=t.next()).done)break;i=r.value}i(n)}},t.B=function(n){return this.U.has(n)||this.U.set(n,new Set),this.U.get(n)},n}());function h(n,t){if(!t)return n&&n.then?n.then(s):Promise.resolve()}n.Workbox=v,n.messageSW=t,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).workbox={})}(this,function(n){"use strict";try{self["workbox:window:5.0.0-rc.0"]&&_()}catch(n){}function t(n,t){return new Promise(function(e){var r=new MessageChannel;r.port1.onmessage=function(n){e(n.data)},n.postMessage(t,[r.port2])})}function e(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}try{self["workbox:core:5.0.0-rc.0"]&&_()}catch(n){}var r=function(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})};function i(n,t){var e=location.href;return new URL(n,e).href===new URL(t,e).href}var o=function(n,t){this.type=n,Object.assign(this,t)};function u(n,t,e){return e?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}var a=200;function c(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return Promise.resolve(n.apply(this,t))}catch(n){return Promise.reject(n)}}}var f=6e4;function s(){}var v=function(n){var s,v;function l(t,e){var s;return void 0===e&&(e={}),(s=n.call(this)||this).t={},s.i=0,s.o=new r,s.u=new r,s.s=new r,s.v=0,s.h=new Set,s.l=function(){var n=s.g,t=n.installing;s.i>0||!i(t.scriptURL,s.m)||performance.now()>s.v+f?(s.p=t,n.removeEventListener("updatefound",s.l)):(s.P=t,s.h.add(t),s.o.resolve(t)),++s.i,t.addEventListener("statechange",s.j)},s.j=function(n){var t=s.g,e=n.target,r=e.state,i=e===s.p,u=i?"external":"",c={sw:e,originalEvent:n};!i&&s.k&&(c.isUpdate=!0),s.dispatchEvent(new o(u+r,c)),"installed"===r?s.O=self.setTimeout(function(){"installed"===r&&t.waiting===e&&s.dispatchEvent(new o(u+"waiting",c))},a):"activating"===r&&(clearTimeout(s.O),i||s.u.resolve(e))},s._=function(n){var t=s.P;t===navigator.serviceWorker.controller&&(s.dispatchEvent(new o("controlling",{sw:t,originalEvent:n,isUpdate:s.k})),s.s.resolve(t))},s.L=c(function(n){var t=n.data,e=n.source;return u(s.getSW(),function(){s.h.has(e)&&s.dispatchEvent(new o("message",{data:t,sw:e,originalEvent:n}))})}),s.m=t,s.t=e,navigator.serviceWorker.addEventListener("message",s.L),s}v=n,(s=l).prototype=Object.create(v.prototype),s.prototype.constructor=s,s.__proto__=v;var d,w,g,m=l.prototype;return m.register=c(function(n){var t=this,e=(void 0===n?{}:n).immediate,r=void 0!==e&&e;return function(n,t){var e=n();if(e&&e.then)return e.then(t);return t(e)}(function(){if(!r&&"complete"!==document.readyState)return h(new Promise(function(n){return addEventListener("load",n)}))},function(){return t.k=Boolean(navigator.serviceWorker.controller),t.M=t.R(),u(t.S(),function(n){t.g=n,t.M&&(t.P=t.M,t.u.resolve(t.M),t.s.resolve(t.M),t.M.addEventListener("statechange",t.j,{once:!0}));var e=t.g.waiting;return e&&i(e.scriptURL,t.m)&&(t.P=e,Promise.resolve().then(function(){t.dispatchEvent(new o("waiting",{sw:e,wasWaitingBeforeRegister:!0}))}).then(function(){})),t.P&&(t.o.resolve(t.P),t.h.add(t.P)),t.g.addEventListener("updatefound",t.l),navigator.serviceWorker.addEventListener("controllerchange",t._,{once:!0}),t.g})})}),m.update=c(function(){if(this.g)return h(this.g.update())}),m.getSW=c(function(){return void 0!==this.P?this.P:this.o.promise}),m.messageSW=c(function(n){return u(this.getSW(),function(e){return t(e,n)})}),m.R=function(){var n=navigator.serviceWorker.controller;return n&&i(n.scriptURL,this.m)?n:void 0},m.S=c(function(){var n=this;return function(n,t){try{var e=n()}catch(n){return t(n)}if(e&&e.then)return e.then(void 0,t);return e}(function(){return u(navigator.serviceWorker.register(n.m,n.t),function(t){return n.v=performance.now(),t})},function(n){throw n})}),d=l,(w=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&e(d.prototype,w),g&&e(d,g),l}(function(){function n(){this.U=new Map}var t=n.prototype;return t.addEventListener=function(n,t){this.B(n).add(t)},t.removeEventListener=function(n,t){this.B(n).delete(t)},t.dispatchEvent=function(n){n.target=this;var t=this.B(n.type),e=Array.isArray(t),r=0;for(t=e?t:t[Symbol.iterator]();;){var i;if(e){if(r>=t.length)break;i=t[r++]}else{if((r=t.next()).done)break;i=r.value}i(n)}},t.B=function(n){return this.U.has(n)||this.U.set(n,new Set),this.U.get(n)},n}());function h(n,t){if(!t)return n&&n.then?n.then(s):Promise.resolve()}n.Workbox=v,n.messageSW=t,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=workbox-window.prod.umd.js.map |
{ | ||
"name": "workbox-window", | ||
"version": "5.0.0-beta.1", | ||
"version": "5.0.0-rc.0", | ||
"license": "MIT", | ||
@@ -32,5 +32,5 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^5.0.0-beta.1" | ||
"workbox-core": "^5.0.0-rc.0" | ||
}, | ||
"gitHead": "01a9e9be8291f0a592891c8e2eb8d2dd09b93caf" | ||
"gitHead": "94542f92ceaec96ef59a09bda3aee1677ea5512b" | ||
} |
// @ts-ignore | ||
try{self['workbox:window:5.0.0-beta.1']&&_()}catch(e){} | ||
try{self['workbox:window:5.0.0-rc.0']&&_()}catch(e){} |
@@ -21,3 +21,3 @@ /* | ||
target?: WorkboxEventTarget; | ||
sw: ServiceWorker; | ||
sw?: ServiceWorker; | ||
originalEvent?: Event; | ||
@@ -24,0 +24,0 @@ |
@@ -30,3 +30,3 @@ /* | ||
const foo = this._getEventListenersByType(type) | ||
foo.add(listener); | ||
foo.add(listener as ListenerCallback); | ||
} | ||
@@ -40,3 +40,3 @@ | ||
removeEventListener<K extends keyof WorkboxEventMap>(type: K, listener: (event: WorkboxEventMap[K]) => any) { | ||
this._getEventListenersByType(type).delete(listener); | ||
this._getEventListenersByType(type).delete(listener as ListenerCallback); | ||
} | ||
@@ -43,0 +43,0 @@ |
@@ -10,3 +10,5 @@ /* | ||
import {Deferred} from 'workbox-core/_private/Deferred.js'; | ||
import {dontWaitFor} from 'workbox-core/_private/dontWaitFor.js'; | ||
import {logger} from 'workbox-core/_private/logger.js'; | ||
import {messageSW} from './messageSW.js'; | ||
@@ -16,5 +18,5 @@ import {WorkboxEventTarget} from './utils/WorkboxEventTarget.js'; | ||
import {WorkboxEvent, WorkboxLifecycleEventMap} from './utils/WorkboxEvent.js'; | ||
import './_version.js'; | ||
// The time a SW must be in the waiting phase before we can conclude | ||
@@ -125,4 +127,4 @@ // `skipWaiting()` wasn't called. This 200 amount wasn't scientifically | ||
this._sw = this._compatibleControllingSW; | ||
this._activeDeferred.resolve(this._compatibleControllingSW); | ||
this._controllingDeferred.resolve(this._compatibleControllingSW); | ||
this._activeDeferred.resolve!(this._compatibleControllingSW); | ||
this._controllingDeferred.resolve!(this._compatibleControllingSW); | ||
@@ -146,3 +148,3 @@ this._compatibleControllingSW.addEventListener( | ||
// listener after awaiting `register()` will get this event. | ||
Promise.resolve().then(() => { | ||
dontWaitFor(Promise.resolve().then(() => { | ||
this.dispatchEvent(new WorkboxEvent('waiting', { | ||
@@ -156,3 +158,3 @@ sw: waitingSW, | ||
} | ||
}); | ||
})); | ||
} | ||
@@ -162,3 +164,3 @@ | ||
if (this._sw) { | ||
this._swDeferred.resolve(this._sw); | ||
this._swDeferred.resolve!(this._sw); | ||
this._ownSWs.add(this._sw); | ||
@@ -373,3 +375,3 @@ } | ||
this._ownSWs.add(installingSW); | ||
this._swDeferred.resolve(installingSW); | ||
this._swDeferred.resolve!(installingSW); | ||
@@ -448,3 +450,3 @@ // The `installing` state isn't something we have a dedicated | ||
if (!isExternal) { | ||
this._activeDeferred.resolve(sw); | ||
this._activeDeferred.resolve!(sw); | ||
} | ||
@@ -502,3 +504,3 @@ } | ||
} | ||
this._controllingDeferred.resolve(sw); | ||
this._controllingDeferred.resolve!(sw); | ||
} | ||
@@ -505,0 +507,0 @@ } |
@@ -12,3 +12,3 @@ import { WorkboxEventTarget } from './WorkboxEventTarget.js'; | ||
target?: WorkboxEventTarget; | ||
sw: ServiceWorker; | ||
sw?: ServiceWorker; | ||
originalEvent?: Event; | ||
@@ -15,0 +15,0 @@ constructor(type: K, props: Omit<WorkboxEventMap[K], 'target' | 'type'>); |
@@ -9,2 +9,3 @@ /* | ||
import { Deferred } from 'workbox-core/_private/Deferred.js'; | ||
import { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js'; | ||
import { logger } from 'workbox-core/_private/logger.js'; | ||
@@ -309,3 +310,3 @@ import { messageSW } from './messageSW.js'; | ||
// listener after awaiting `register()` will get this event. | ||
Promise.resolve().then(() => { | ||
dontWaitFor(Promise.resolve().then(() => { | ||
this.dispatchEvent(new WorkboxEvent('waiting', { | ||
@@ -319,3 +320,3 @@ sw: waitingSW, | ||
} | ||
}); | ||
})); | ||
} | ||
@@ -322,0 +323,0 @@ // If an "own" SW is already set, resolve the deferred. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 4 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
606138
4511
5
Updatedworkbox-core@^5.0.0-rc.0