瀏覽代碼

feat: check for sw updates (#108)

Lucas Neves Pereira 1 月之前
父節點
當前提交
154f6181fd
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/components/pwa/ServiceWorkerRegistration.tsx

+ 2 - 0
src/components/pwa/ServiceWorkerRegistration.tsx

@@ -9,6 +9,8 @@ export function ServiceWorkerRegistration() {
         .register("/sw.js")
         .then((registration) => {
           console.log("SW registered: ", registration);
+          // Check for updates
+          registration.update();
         })
         .catch((registrationError) => {
           console.log("SW registration failed: ", registrationError);