lex пре 1 година
родитељ
комит
7451e71776
1 измењених фајлова са 14 додато и 0 уклоњено
  1. 14 0
      src/App.tsx

+ 14 - 0
src/App.tsx

@@ -204,6 +204,20 @@ export default defineComponent({
         }
       });
       // console.log('app - onounted - test interval');
+
+      if ('serviceWorker' in navigator) {
+        navigator.serviceWorker.getRegistrations().then(registrations => {
+          for (const registration of registrations) {
+            if (registration.scope.startsWith(`https://${location.host}/`)) {
+              registration.unregister().then(() => {
+                console.log(
+                  `Service Worker unregistered for https://${location.host}/`
+                );
+              });
+            }
+          }
+        });
+      }
     });
     onUnmounted(() => {
       window.removeEventListener('message', handleOpen);