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