restore modal animation on desktop
This commit is contained in:
Vendored
+19
-18
@@ -1,31 +1,32 @@
|
||||
const CACHE_VERSION = "v2";
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
event.respondWith(handleRequest(event));
|
||||
event.respondWith(handleRequest(event));
|
||||
});
|
||||
|
||||
async function handleRequest(event) {
|
||||
const response = await getFromCache(event);
|
||||
if (response) {
|
||||
fetchAndCache(event); // Call this but don't await, allowing the cache to update in the background
|
||||
return response;
|
||||
}
|
||||
return fetchAndCache(event);
|
||||
const response = await getFromCache(event);
|
||||
if (response) {
|
||||
fetchAndCache(event); // Call this but don't await, allowing the cache to update in the background
|
||||
return response;
|
||||
}
|
||||
return fetchAndCache(event);
|
||||
}
|
||||
|
||||
async function getFromCache(event) {
|
||||
const request = event.request;
|
||||
const cache = await caches.open(CACHE_VERSION);
|
||||
const response = await cache.match(request);
|
||||
return response;
|
||||
const request = event.request;
|
||||
const cache = await caches.open(CACHE_VERSION);
|
||||
const response = await cache.match(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
async function fetchAndCache(event) {
|
||||
const request = event.request;
|
||||
const response = await fetch(request);
|
||||
if (response.status === 200) { // Only cache successful responses
|
||||
const cache = await caches.open(CACHE_VERSION);
|
||||
cache.put(request, response.clone());
|
||||
}
|
||||
return response;
|
||||
const request = event.request;
|
||||
const response = await fetch(request);
|
||||
if (response.status === 200) {
|
||||
// Only cache successful responses
|
||||
const cache = await caches.open(CACHE_VERSION);
|
||||
cache.put(request, response.clone());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user