Skip to content

Commit

Permalink
Cache index.html on page first load
Browse files Browse the repository at this point in the history
  • Loading branch information
sansmoraxz committed Apr 16, 2023
1 parent ceab8bb commit 23f00c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/serviceWorker/service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import {APP_NAME} from '../constant';
self.addEventListener('install', event => { // register
console.log('serviceWorker installed');
event.waitUntil(async () => {
await caches.open(APP_NAME);
await caches.open(APP_NAME).then(
cache => cache.addAll([
'/',
'/index.html',
])
);
console.log('serviceWorker installed...');
});
});
Expand Down

0 comments on commit 23f00c1

Please sign in to comment.