Service Worker: Cache-Schreibvorgang sicher abschließen
This commit is contained in:
parent
90e83d6367
commit
1f116251cf
1 changed files with 6 additions and 2 deletions
|
|
@ -113,8 +113,12 @@ async function networkFirstNavigation(request) {
|
|||
function staleWhileRevalidate(request, event) {
|
||||
var network = fetch(request).then(function (response) {
|
||||
if (response && response.ok && response.type === 'basic') {
|
||||
caches.open(CACHE_VERSION).then(function (cache) {
|
||||
cache.put(request, response.clone());
|
||||
var copy = response.clone();
|
||||
|
||||
return caches.open(CACHE_VERSION).then(function (cache) {
|
||||
return cache.put(request, copy);
|
||||
}).then(function () {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue