Strategy: cache only

This commit is contained in:
2026-04-21 15:32:01 +03:30
parent 5a5bd5ff1a
commit 6e5889590d

View File

@@ -61,12 +61,18 @@ self.addEventListener("activate", function (event) {
// Strategy: cache with network fallback // Strategy: cache with network fallback
// self.addEventListener("fetch", (event) => {
// event.respondWith(
// caches.open(CACHE_STATIC_NAME).then((cache) => {
// return cache.match(event.request).then((res) => {
// return res || fetch(event.request);
// });
// }),
// );
// });
// Strategy: cache only
self.addEventListener("fetch", (event) => { self.addEventListener("fetch", (event) => {
event.respondWith( event.respondWith(caches.match(event.request));
caches.open(CACHE_STATIC_NAME).then((cache) => {
return cache.match(event.request).then((res) => {
return res || fetch(event.request);
});
}),
);
}); });