Skip to content

Commit

Permalink
PWA non cache
Browse files Browse the repository at this point in the history
  • Loading branch information
yarekc committed Jun 27, 2019
1 parent 0bd465d commit 063fb69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ self.addEventListener('install', async event => {
await cache.addAll(staticAssets);
});
self.addEventListener('fetch', event => {
const req = event.request;
event.respondWith(cacheFirst(req));
fetch(event.request)
});
async function cacheFirst(req) {
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(req);
return cachedResponse || fetch(req);
}
```
6. create and upload the **offline.html** page to the root
```
Expand Down

0 comments on commit 063fb69

Please sign in to comment.