Correct service worker name

This commit is contained in:
Jake Archibald
2020-12-09 21:54:08 +00:00
parent c6e6042726
commit 722f1c806c
2 changed files with 17 additions and 1 deletions

14
src/copy/sw.js Normal file
View File

@@ -0,0 +1,14 @@
// I accidentally shipped with the wrong service worker name.
// This picks up users that still might be using that version.
// We'll be able to delete this file eventually.
addEventListener('install', () => {
skipWaiting();
});
addEventListener('activate', async () => {
await self.registration.unregister();
const allClients = await clients.matchAll({
includeUncontrolled: true,
});
for (const client of allClients) client.navigate('/');
});