bump beta.18

This commit is contained in:
undefined committed 2026-02-19 19:01:33 +08:00
1 parent f42427ee83
commit f09b422327
15 files changed
+34 -18

No files matched your search

+12 -5
View File
@@ -31,13 +31,20 @@ try {
__webpack_public_path__ = UiContext.cdn_prefix;
} catch (e) { }
if ('serviceWorker' in navigator) {
const sendConfig = () => fetch('/service-worker-config', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(UiContext.SWConfig),
});
navigator.serviceWorker.register('/service-worker.js').then((registration) => {
console.log('SW registered: ', registration);
fetch('/service-worker-config', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(UiContext.SWConfig),
});
const sw = registration.active || registration.waiting || registration.installing;
if (sw.state === 'activated') sendConfig();
else {
sw.addEventListener('statechange', (e) => {
if (e.target.state === 'activated') sendConfig();
});
}
}).catch((registrationError) => {
console.log('SW registration failed: ', registrationError);
});