diff --git a/_includes/head/custom.html b/_includes/head/custom.html index 9a57aeb3..7082be1b 100644 --- a/_includes/head/custom.html +++ b/_includes/head/custom.html @@ -3,37 +3,3 @@ -
- - - - - - diff --git a/serviceWorker.js b/serviceWorker.js deleted file mode 100644 index aa14f2ff..00000000 --- a/serviceWorker.js +++ /dev/null @@ -1,58 +0,0 @@ -// This file used https://alokprateek.in/articles/jekyll-pwa/ as a reference/guide - -const CACHE = "root-offline"; - -const offlineFallbackPage = "index.html"; - -// Install stage sets up the index page (home page) in the cache and opens a new cache -self.addEventListener("install", function (event) { - console.log("Install Event processing"); - - event.waitUntil( - caches.open(CACHE).then(function (cache) { - console.log("Cached offline page during install"); - return cache.add(offlineFallbackPage); - }) - ); -}); - -// If any fetch fails, it will look for the request in the cache and serve it from there first -self.addEventListener("fetch", function (event) { - if (event.request.method !== "GET") return; - - event.respondWith( - fetch(event.request) - .then(function (response) { - - // If request was success, add or update it in the cache - event.waitUntil(updateCache(event.request, response.clone())); - - return response; - }) - .catch(function (error) { - console.log("Network request Failed. Serving content from cache: " + error); - return fromCache(event.request); - }) - ); -}); - -function fromCache(request) { - // Check to see if you have it in the cache - // Return response - // If not in the cache, then return error page - return caches.open(CACHE).then(function (cache) { - return cache.match(request).then(function (matching) { - if (!matching || matching.status === 404) { - return Promise.reject("no-match"); - } - - return matching; - }); - }); -} - -function updateCache(request, response) { - return caches.open(CACHE).then(function (cache) { - return cache.put(request, response); - }); -}