mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Integrate PWA service worker registration using virtual:pwa-register
.
This commit is contained in:

committed by
Geoff Seemueller

parent
f055cd39fe
commit
36f8fcee87
@@ -1,4 +1,6 @@
|
||||
// runs before anything else
|
||||
import { registerSW } from 'virtual:pwa-register';
|
||||
|
||||
import UserOptionsStore from '../stores/UserOptionsStore';
|
||||
|
||||
UserOptionsStore.initialize();
|
||||
@@ -6,7 +8,11 @@ UserOptionsStore.initialize();
|
||||
try {
|
||||
const isLocal = window.location.hostname.includes('localhost');
|
||||
if (!isLocal) {
|
||||
navigator.serviceWorker.register('/service-worker.js');
|
||||
if ('serviceWorker' in navigator) {
|
||||
// && !/localhost/.test(window.location)) {
|
||||
registerSW();
|
||||
}
|
||||
// navigator.serviceWorker.register('/service-worker.js');
|
||||
} else {
|
||||
(async () => {
|
||||
await navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
|
Reference in New Issue
Block a user