From 5aab52d9452d21e8ef64e38cc5ec7b444f919423 Mon Sep 17 00:00:00 2001 From: alexkiro <1538458+alexkiro@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:40:09 +0200 Subject: [PATCH] Add files via upload --- public/sw.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 public/sw.js diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000..860da8c --- /dev/null +++ b/public/sw.js @@ -0,0 +1,18 @@ +// This is the "Offline copy of pages" service worker + +const CACHE = "pwabuilder-offline"; + +importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js'); + +self.addEventListener("message", (event) => { + if (event.data && event.data.type === "SKIP_WAITING") { + self.skipWaiting(); + } +}); + +workbox.routing.registerRoute( + new RegExp('/*'), + new workbox.strategies.StaleWhileRevalidate({ + cacheName: CACHE + }) +); \ No newline at end of file