Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const CACHE = 'v1';
self.addEventListener('install', function (event) {
console.log('The service worker is being installed.');
self.addEventListener('fetch', function (event) {
console.log('The service worker is serving the assets.');
function precache() {
return (cache) {
return cache.addAll([
function fromProxy(request) {
return (cache) {
return cache.match(request).then(function (matching) {
return matching || fetch(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.