add experimental boot

This commit is contained in:
Stewart Allen 2025-10-12 19:31:14 -04:00
commit 25b55383a3
2 changed files with 233 additions and 0 deletions

56
web/boot/index.html Normal file
View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Kiri:Moto (loading)</title>
<style>
body {
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
position: fixed;
align-items: center;
flex-direction: column;
justify-content: center;
font-family: sans-serif;
font-weight: bold;
}
</style>
<script>
(async () => {
const reg = await navigator.serviceWorker.register('/boot/service.js', { scope: '/' });
await reg.update();
await navigator.serviceWorker.ready;
if (!navigator.serviceWorker.controller) {
console.log('No controller → reloading under SW control');
location.reload();
return;
}
navigator.serviceWorker.controller.postMessage({
mode: 'cached',
version: 1
});
navigator.serviceWorker.addEventListener('message', e => {
if (e.data === 'preload-complete') {
console.log('preload complete');
location.replace('/kiri/index.html');
} else if (e.data === 'preload-cached') {
console.log('preload cached');
location.replace('/kiri/index.html');
}
});
})();
</script>
</head>
<body>
Kiri:Moto is Loading
</body>
</html>