This commit is contained in:
Renan LE CARO 2025-03-14 20:12:02 +01:00
parent cdfe6a4978
commit 934670b2a7
11 changed files with 84 additions and 3 deletions

BIN
public/icon-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

BIN
public/icon-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

View file

@ -3,12 +3,22 @@
"name": "Breakout 71",
"icons": [
{
"src": "/icon.png",
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/icon-128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/icon-64.png",
"sizes": "64x64",
"type": "image/png"
}
],
"start_url": ".",
"start_url": "/index.html?isPWA=true",
"display": "fullscreen",
"theme_color": "#5DA3EA",
"background_color": "#ffffff"

44
public/sw-b71.js Normal file
View file

@ -0,0 +1,44 @@
// The version of the cache.
const VERSION = '29032991'
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;
// The static resources that the app needs to function.
const APP_STATIC_RESOURCES = [
"/"
];
// On install, cache the static resources
self.addEventListener("install", (event) => {
event.waitUntil(
(async () => {
const cache = await caches.open(CACHE_NAME);
cache.addAll(APP_STATIC_RESOURCES);
})(),
);
});
// delete old caches on activate
self.addEventListener("activate", (event) => {
event.waitUntil(
(async () => {
const names = await caches.keys();
await Promise.all(
names.map((name) => {
if (name !== CACHE_NAME) {
return caches.delete(name);
}
}),
);
await clients.claim();
})(),
);
});
self.addEventListener("fetch", (event) => {
if (event.request.mode === "navigate" && event.request.url.endsWith('/index.html?isPWA=true')) {
event.respondWith(caches.match("/"));
return;
}
});