File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ const PRECACHE_ASSETS = [
3434 '/audio/sfx/tridecco.wav' ,
3535 '/audio/sfx/victory.wav' ,
3636
37- '/css /styles.css' ,
37+ '/styles /styles.css' ,
3838
39- '/font /tridecco.ttf' ,
39+ '/fonts /tridecco.ttf' ,
4040
4141 '/img/default-avatar.svg' ,
4242 '/img/backgrounds/broken-glass.jpg' ,
@@ -93,10 +93,18 @@ const PRECACHE_ASSETS = [
9393
9494self . addEventListener ( 'install' , ( event ) => {
9595 event . waitUntil (
96- caches
97- . open ( STATIC_CACHE )
98- . then ( ( cache ) => cache . addAll ( PRECACHE_ASSETS ) )
99- . then ( ( ) => self . skipWaiting ( ) ) ,
96+ ( async ( ) => {
97+ const cache = await caches . open ( STATIC_CACHE ) ;
98+
99+ for ( const asset of PRECACHE_ASSETS ) {
100+ try {
101+ const response = await fetch ( asset ) ;
102+ await cache . put ( asset , response ) ;
103+ } catch ( err ) {
104+ console . warn ( `Failed to cache ${ asset } :` , err ) ;
105+ }
106+ }
107+ } ) ( ) . then ( ( ) => self . skipWaiting ( ) ) ,
100108 ) ;
101109} ) ;
102110
You can’t perform that action at this time.
0 commit comments