Node.js based forum software built for the modern web
fix: add logic to automatically take over clients from old service workers
Julian Lam1fbf91148903
diff --git a/public/src/service-worker.js b/public/src/service-worker.jsindex 2689fcf87c..0329661593 100644--- a/public/src/service-worker.js+++ b/public/src/service-worker.js@@ -1,5 +1,15 @@'use strict';+self.addEventListener('install', () => {+ // Register self as the primary service worker+ self.skipWaiting();+});++self.addEventListener('activate', (event) => {+ // Take responsibility over existing clients from old service worker+ event.waitUntil(self.clients.claim());+});+self.addEventListener('fetch', function (event) {// This is the code that ignores post requests// https://github.com/NodeBB/NodeBB/issues/9151