Skip to content

Commit

Permalink
Revert "fix serviceWorker cache: auto caching files by workbox"
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa authored Oct 25, 2023
1 parent d1c3d90 commit 70e67a6
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions public/serviceWorker.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
const CHATGPT_NEXT_WEB_CACHE = "chatgpt-next-web-cache";

importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js');

self.addEventListener("activate", function (event) {
console.log("ServiceWorker activated.");
});

workbox.core.clientsClaim();
self.addEventListener("message", (event) => {
if (event.data && event.data.type === "SKIP_WAITING") {
self.skipWaiting();
}
self.addEventListener("install", function (event) {
event.waitUntil(
caches.open(CHATGPT_NEXT_WEB_CACHE).then(function (cache) {
return cache.addAll([]);
}),
);
});

workbox.routing.registerRoute(
new RegExp('/*'),
new workbox.strategies.StaleWhileRevalidate({
cacheName: CHATGPT_NEXT_WEB_CACHE
})
);
self.addEventListener("fetch", (e) => {});

0 comments on commit 70e67a6

Please sign in to comment.