mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: add logic to automatically take over clients from old service workers
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user