UNPKG

@pwabuilder/pwainstall

Version:

![CI](https://github.com/pwa-builder/pwa-install/workflows/CI/badge.svg)

37 lines (26 loc) 926 B
// This is the service worker with the Cache-first network const CACHE = "pwabuilder-precachev2"; const precacheFiles = [ /* Add an array of files to precache for your app */ ]; self.addEventListener("install", function (event) { console.log("[PWA Builder] Install Event processing"); console.log("[PWA Builder] Skip waiting on install"); self.skipWaiting(); event.waitUntil( caches.open(CACHE).then(function (cache) { }) ); }); // Allow sw to control of current page self.addEventListener("activate", function (event) { console.log("[PWA Builder] Claiming clients for current page"); event.waitUntil(self.clients.claim()); }); // If any fetch fails, it will look for the request in the cache and serve it from there first self.addEventListener("fetch", function (event) { }); function fromCache(request) { } function updateCache(request, response) { }