Build 29035725

This commit is contained in:
Renan LE CARO 2025-03-16 17:45:29 +01:00
parent a1bf54af71
commit 819197031f
64 changed files with 3494 additions and 6921 deletions

BIN
src/PWA/icon-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

BIN
src/PWA/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
src/PWA/icon-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

8
src/PWA/icon.svg Normal file
View file

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" height="50" width="50">
<rect x="0" y="0" width="30" height="10" fill="#6262EA"/>
<rect x="20" y="10" width="10" height="10" fill="#6262EA"/>
<rect x="10" y="20" width="10" height="20" fill="#6262EA"/>
<rect x="20" y="20" width="10" height="10" fill="#5DA3EA"/>
<rect x="30" y="10" width="10" height="30" fill="#5DA3EA"/>
<rect x="20" y="40" width="40" height="30" fill="#5DA3EA"/>
</svg>

After

Width:  |  Height:  |  Size: 428 B

25
src/PWA/manifest.json Normal file
View file

@ -0,0 +1,25 @@
{
"short_name": "B71",
"name": "Breakout 71",
"icons": [
{
"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": "/index.html?isPWA=true",
"display": "fullscreen",
"theme_color": "#5DA3EA",
"background_color": "#ffffff"
}

45
src/PWA/sw-b71.js Normal file
View file

@ -0,0 +1,45 @@
// The version of the cache.
const VERSION = "29035725";
// 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;
}
});

7
src/PWA/sw_loader.ts Normal file
View file

@ -0,0 +1,7 @@
if (
"serviceWorker" in navigator &&
window.location.search.includes("isPWA=true")
) {
// @ts-ignore
navigator.serviceWorker.register(new URL("sw-b71.js", import.meta.url));
}