mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
.
This commit is contained in:
parent
681ca82671
commit
1ce214f13b
@ -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',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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!');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user