mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
.
This commit is contained in:
parent
9bc16cfb0b
commit
c0425bc722
@ -11,17 +11,9 @@ self.addEventListener('install', (event) => {
|
||||
|
||||
for (const asset of cacheAssets) {
|
||||
await cache.add(asset);
|
||||
cachedAssets++;
|
||||
const progress = `${cachedAssets}/${totalAssets}`;
|
||||
const progress = `${++cachedAssets}/${totalAssets}`;
|
||||
|
||||
self.clients.matchAll().then((clients) => {
|
||||
clients.forEach((client) => {
|
||||
client.postMessage({
|
||||
title: 'sw-install-progress',
|
||||
message: progress,
|
||||
});
|
||||
});
|
||||
});
|
||||
console.log(`Cached: ${asset} (${progress})`);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -271,12 +271,11 @@ const serviceworker = {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/service-worker.js').then(() => {
|
||||
navigator.serviceWorker.addEventListener('message', (event) => {
|
||||
if (event.data.title === 'sw-install-progress') {
|
||||
// doesn't work bc inactive service worker cant claim client
|
||||
console.log(`Service worker install: ${event.data.message} assets downloaded`);
|
||||
} else if (event.data.title === 'sw-install-complete') {
|
||||
if (event.origin === window.location.origin) {
|
||||
if (event.data.title === 'sw-install-complete') {
|
||||
alert('MineXLauncher is now ready for offline use!');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user