Skip to content

Commit 4372925

Browse files
install to be more resilient
1 parent 20162ed commit 4372925

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/_javascript/serviceworker/install.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ self.addEventListener( "install", function( event ){
88
event.waitUntil(
99
caches.open( sw_caches.static.name )
1010
.then(function( cache ){
11-
return cache.addAll( preinstall );
11+
return Promise.all(
12+
preinstall.map(asset => {
13+
return cache.add(asset).catch(err => {
14+
console.error(`Failed to cache ${asset}:`, err);
15+
});
16+
})
17+
);
1218
})
1319
);
1420

0 commit comments

Comments
 (0)