1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00
This commit is contained in:
zumbiepig 2024-08-19 14:07:21 -07:00
parent 681ca82671
commit 1ce214f13b
2 changed files with 6 additions and 6 deletions

View File

@ -16,8 +16,8 @@ self.addEventListener('install', (event) => {
const clients = await self.clients.matchAll(); const clients = await self.clients.matchAll();
clients.forEach((client) => { clients.forEach((client) => {
client.postMessage({ client.postMessage({
type: 'sw-install-progress', title: 'sw-install-progress',
msg: progress, message: progress,
}); });
}); });
} }
@ -45,7 +45,7 @@ self.addEventListener('activate', (event) => {
return self.clients.matchAll().then((clients) => { return self.clients.matchAll().then((clients) => {
clients.forEach((client) => { clients.forEach((client) => {
client.postMessage({ client.postMessage({
type: 'sw-activation-complete', title: 'sw-install-complete',
}); });
}); });
}); });

View File

@ -6,10 +6,10 @@ if ('serviceWorker' in navigator) {
console.log('Service worker registered with scope:', registration.scope); console.log('Service worker registered with scope:', registration.scope);
navigator.serviceWorker.addEventListener('message', (event) => { navigator.serviceWorker.addEventListener('message', (event) => {
if (event.data && event.data.type === 'install-progress') { if (event.data.title === 'sw-install-progress') {
console.log(`Service worker installation progress: ${event.data.msg} assets`); console.log(`Service worker installation progress: ${event.data.message} assets downloaded`);
// Update your UI with the progress // Update your UI with the progress
} else if (event.data && event.data.type === 'activation-complete') { } else if (event.data.title === 'sw-install-complete') {
console.log('Service worker installation is complete!'); console.log('Service worker installation is complete!');
alert('Service worker installation is complete!'); alert('Service worker installation is complete!');
} }