Pause when tab is hidden, using visibility change api

This commit is contained in:
Renan LE CARO 2025-03-15 10:34:01 +01:00
parent 1a56b5f1d1
commit 33d74e8c84
68 changed files with 7290 additions and 6933 deletions

View file

@ -1,13 +1,11 @@
// The version of the cache.
const VERSION = '29032991'
const VERSION = "29033834";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;
// The static resources that the app needs to function.
const APP_STATIC_RESOURCES = [
"/"
];
const APP_STATIC_RESOURCES = ["/"];
// On install, cache the static resources
self.addEventListener("install", (event) => {
@ -37,7 +35,10 @@ self.addEventListener("activate", (event) => {
});
self.addEventListener("fetch", (event) => {
if (event.request.mode === "navigate" && event.request.url.endsWith('/index.html?isPWA=true')) {
if (
event.request.mode === "navigate" &&
event.request.url.endsWith("/index.html?isPWA=true")
) {
event.respondWith(caches.match("/"));
return;
}