workbox-broadcast-update
Advanced tools
Comparing version 7.0.0 to 7.1.0
@@ -5,2 +5,3 @@ this.workbox = this.workbox || {}; | ||
// @ts-ignore | ||
try { | ||
@@ -28,3 +29,2 @@ self['workbox:broadcast-update:7.0.0'] && _(); | ||
*/ | ||
const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => { | ||
@@ -36,7 +36,5 @@ { | ||
} | ||
const atLeastOneHeaderAvailable = headersToCheck.some(header => { | ||
return firstResponse.headers.has(header) && secondResponse.headers.has(header); | ||
}); | ||
if (!atLeastOneHeaderAvailable) { | ||
@@ -46,9 +44,7 @@ { | ||
logger_js.logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck); | ||
} // Just return true, indicating the that responses are the same, since we | ||
} | ||
// Just return true, indicating the that responses are the same, since we | ||
// can't determine otherwise. | ||
return true; | ||
} | ||
return headersToCheck.every(header => { | ||
@@ -80,5 +76,5 @@ const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header); | ||
*/ | ||
// UA-sniff Safari: https://stackoverflow.com/questions/7944460/detect-safari-browser | ||
// TODO(philipwalton): remove once this Safari bug fix has been released. | ||
// https://bugs.webkit.org/show_bug.cgi?id=201169 | ||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); | ||
@@ -92,3 +88,2 @@ /** | ||
*/ | ||
function defaultPayloadGenerator(data) { | ||
@@ -109,4 +104,2 @@ return { | ||
*/ | ||
class BroadcastCacheUpdate { | ||
@@ -168,4 +161,2 @@ /** | ||
*/ | ||
async notifyIfUpdated(options) { | ||
@@ -191,9 +182,7 @@ { | ||
}); | ||
} // Without two responses there is nothing to compare. | ||
} | ||
// Without two responses there is nothing to compare. | ||
if (!options.oldResponse) { | ||
return; | ||
} | ||
if (!responsesAreSame(options.oldResponse, options.newResponse, this._headersToCheck)) { | ||
@@ -203,3 +192,2 @@ { | ||
} | ||
const messageData = { | ||
@@ -209,13 +197,12 @@ type: CACHE_UPDATED_MESSAGE_TYPE, | ||
payload: this._generatePayload(options) | ||
}; // For navigation requests, wait until the new window client exists | ||
}; | ||
// For navigation requests, wait until the new window client exists | ||
// before sending the message | ||
if (options.request.mode === 'navigate') { | ||
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 | ||
const resultingWin = await resultingClientExists_js.resultingClientExists(resultingClientId); | ||
// Safari does not currently implement postMessage buffering and | ||
// there's no good way to feature detect that, so to increase the | ||
@@ -225,3 +212,2 @@ // chances of the message being delivered in Safari, we add a timeout. | ||
// which means it timed out, so it's worth waiting a bit longer. | ||
if (!resultingWin || isSafari) { | ||
@@ -235,3 +221,2 @@ // 3500 is chosen because (according to CrUX data) 80% of mobile | ||
} | ||
if (this._notifyAllClients) { | ||
@@ -241,3 +226,2 @@ const windows = await self.clients.matchAll({ | ||
}); | ||
for (const win of windows) { | ||
@@ -255,3 +239,2 @@ win.postMessage(messageData); | ||
} | ||
} | ||
@@ -272,3 +255,2 @@ | ||
*/ | ||
class BroadcastUpdatePlugin { | ||
@@ -305,6 +287,4 @@ /** | ||
}; | ||
this._broadcastUpdate = new BroadcastCacheUpdate(options); | ||
} | ||
} | ||
@@ -318,3 +298,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, workbox.core._private); | ||
//# sourceMappingURL=workbox-broadcast-update.dev.js.map |
{ | ||
"name": "workbox-broadcast-update", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"license": "MIT", | ||
@@ -25,5 +25,5 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "7.0.0" | ||
"workbox-core": "7.1.0" | ||
}, | ||
"gitHead": "c1d11636823e5e3a89520f7a531970a39304b14a" | ||
"gitHead": "9e69c4269c35e2db9fbba4d13e4e6206c7b66d2a" | ||
} |
// @ts-ignore | ||
try{self['workbox:broadcast-update:7.0.0']&&_()}catch(e){} | ||
try{self['workbox:broadcast-update:7.1.0']&&_()}catch(e){} |
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
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
113154
0
100
1072
+ Addedworkbox-core@7.1.0(transitive)
- Removedworkbox-core@7.0.0(transitive)
Updatedworkbox-core@7.1.0