Created
August 27, 2019 20:58
-
-
Save jimwhimpey/1914c47db89daef372c553fa437dc09c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('fetch', (e) => { | |
if (assetManifest.includes(e.request.url) { | |
e.respondWith( | |
caches | |
.open(cacheKey) | |
.then(cache => cache.match(e.request)) | |
.then(response => { | |
if (response) return response; | |
return fetch(e.request); | |
}); | |
); | |
} else { | |
e.respondWith(fetch(e.request)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment