workbox-broadcast-update
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:broadcast-update:5.0.0-beta.1'] && _(); | ||
self['workbox:broadcast-update:5.0.0-rc.0'] && _(); | ||
} | ||
catch (e) { } |
@@ -126,3 +126,6 @@ /* | ||
if (options.request.mode === 'navigate') { | ||
const resultingClientId = options.event && options.event.resultingClientId; | ||
let resultingClientId; | ||
if (options.event instanceof FetchEvent) { | ||
resultingClientId = options.event.resultingClientId; | ||
} | ||
const resultingWin = await resultingClientExists(resultingClientId); | ||
@@ -129,0 +132,0 @@ // Safari does not currently implement postMessage buffering and |
@@ -8,2 +8,3 @@ /* | ||
*/ | ||
import { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js'; | ||
import { BroadcastCacheUpdate } from './BroadcastCacheUpdate.js'; | ||
@@ -46,3 +47,3 @@ import './_version.js'; | ||
this.cacheDidUpdate = async (options) => { | ||
this._broadcastUpdate.notifyIfUpdated(options); | ||
dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options)); | ||
}; | ||
@@ -49,0 +50,0 @@ this._broadcastUpdate = new BroadcastCacheUpdate(options); |
this.workbox = this.workbox || {}; | ||
this.workbox.broadcastUpdate = (function (exports, assert_js, timeout_js, resultingClientExists_js, logger_js, WorkboxError_js) { | ||
this.workbox.broadcastUpdate = (function (exports, assert_js, timeout_js, resultingClientExists_js, logger_js, WorkboxError_js, dontWaitFor_js) { | ||
'use strict'; | ||
// @ts-ignore | ||
try { | ||
self['workbox:broadcast-update:5.0.0-beta.1'] && _(); | ||
self['workbox:broadcast-update:5.0.0-rc.0'] && _(); | ||
} catch (e) {} | ||
@@ -199,3 +198,8 @@ | ||
if (options.request.mode === 'navigate') { | ||
const resultingClientId = options.event && options.event.resultingClientId; | ||
let resultingClientId; | ||
if (options.event instanceof FetchEvent) { | ||
resultingClientId = options.event.resultingClientId; | ||
} | ||
const resultingWin = await resultingClientExists_js.resultingClientExists(resultingClientId); // Safari does not currently implement postMessage buffering and | ||
@@ -271,3 +275,3 @@ // there's no good way to feature detect that, so to increase the | ||
this.cacheDidUpdate = async options => { | ||
this._broadcastUpdate.notifyIfUpdated(options); | ||
dontWaitFor_js.dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options)); | ||
}; | ||
@@ -286,3 +290,3 @@ | ||
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private)); | ||
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private)); | ||
//# sourceMappingURL=workbox-broadcast-update.dev.js.map |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t,a,s){"use strict";try{self["workbox:broadcast-update:5.0.0-beta.1"]&&_()}catch(t){}const o=(t,a,s)=>{return!s.some(s=>t.headers.has(s)&&a.headers.has(s))||s.every(s=>{const o=t.headers.has(s)===a.headers.has(s),e=t.headers.get(s)===a.headers.get(s);return o&&e})},e="CACHE_UPDATED",n="workbox-broadcast-update",i=["content-length","etag","last-modified"],c=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function r(t){return{cacheName:t.cacheName,updatedURL:t.request.url}}class h{constructor({headersToCheck:t,generatePayload:a}={}){this.t=t||i,this.s=a||r}async notifyIfUpdated(t){if(t.oldResponse&&!o(t.oldResponse,t.newResponse,this.t)){const o={type:e,meta:n,payload:this.s(t)};if("navigate"===t.request.mode){const o=t.event&&t.event.resultingClientId;await s.resultingClientExists(o)&&!c||await a.timeout(3500)}const i=await self.clients.matchAll({type:"window"});for(const t of i)t.postMessage(o)}}}return t.BroadcastCacheUpdate=h,t.BroadcastUpdatePlugin=class{constructor(t){this.cacheDidUpdate=(async t=>{this.o.notifyIfUpdated(t)}),this.o=new h(t)}},t.responsesAreSame=o,t}({},workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t,a,o,e){"use strict";try{self["workbox:broadcast-update:5.0.0-rc.0"]&&_()}catch(t){}const s=(t,a,o)=>{return!o.some(o=>t.headers.has(o)&&a.headers.has(o))||o.every(o=>{const e=t.headers.has(o)===a.headers.has(o),s=t.headers.get(o)===a.headers.get(o);return e&&s})},n="CACHE_UPDATED",i="workbox-broadcast-update",c=["content-length","etag","last-modified"],r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function h(t){return{cacheName:t.cacheName,updatedURL:t.request.url}}class d{constructor({headersToCheck:t,generatePayload:a}={}){this.t=t||c,this.o=a||h}async notifyIfUpdated(t){if(t.oldResponse&&!s(t.oldResponse,t.newResponse,this.t)){const e={type:n,meta:i,payload:this.o(t)};if("navigate"===t.request.mode){let e;t.event instanceof FetchEvent&&(e=t.event.resultingClientId),await o.resultingClientExists(e)&&!r||await a.timeout(3500)}const s=await self.clients.matchAll({type:"window"});for(const t of s)t.postMessage(e)}}}return t.BroadcastCacheUpdate=d,t.BroadcastUpdatePlugin=class{constructor(t){this.cacheDidUpdate=(async t=>{e.dontWaitFor(this.s.notifyIfUpdated(t))}),this.s=new d(t)}},t.responsesAreSame=s,t}({},workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-broadcast-update.prod.js.map |
{ | ||
"name": "workbox-broadcast-update", | ||
"version": "5.0.0-beta.1", | ||
"version": "5.0.0-rc.0", | ||
"license": "MIT", | ||
@@ -30,5 +30,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:broadcast-update:5.0.0-beta.1']&&_()}catch(e){} | ||
try{self['workbox:broadcast-update:5.0.0-rc.0']&&_()}catch(e){} |
@@ -154,4 +154,6 @@ /* | ||
if (options.request.mode === 'navigate') { | ||
const resultingClientId = | ||
options.event && options.event.resultingClientId; | ||
let resultingClientId: string | undefined; | ||
if (options.event instanceof FetchEvent) { | ||
resultingClientId = options.event.resultingClientId; | ||
} | ||
@@ -158,0 +160,0 @@ const resultingWin = await resultingClientExists(resultingClientId); |
@@ -9,4 +9,7 @@ /* | ||
import {dontWaitFor} from 'workbox-core/_private/dontWaitFor.js'; | ||
import {WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {BroadcastCacheUpdate, BroadcastCacheUpdateOptions} from './BroadcastCacheUpdate.js'; | ||
import './_version.js'; | ||
@@ -54,3 +57,3 @@ | ||
cacheDidUpdate: WorkboxPlugin['cacheDidUpdate'] = async (options) => { | ||
this._broadcastUpdate.notifyIfUpdated(options); | ||
dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options)); | ||
} | ||
@@ -57,0 +60,0 @@ } |
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 1 instance 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 1 instance in 1 package
194374
993
Updatedworkbox-core@^5.0.0-rc.0