generated from bcgov/bcrs-template-ui
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19470 - Fix service worker + version number about (#221)
* Fix the about text * revert vite change * Remove service workers * Add in service worker killer
- Loading branch information
Showing
7 changed files
with
88 additions
and
58 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable no-undef */ | ||
// Kill the service worker. | ||
// Import Workbox from a CDN, Since this file is in the public folder and not processed by Vite | ||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.1.5/workbox-sw.js') | ||
|
||
workbox.core.setCacheNameDetails({ prefix: 'fas' }) | ||
// Precache manifest | ||
self.__precacheManifest = [].concat(self.__precacheManifest || []) | ||
workbox.precaching.suppressWarnings && workbox.precaching.suppressWarnings() | ||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {}) | ||
|
||
// Skip waiting on install | ||
self.addEventListener('install', function (e) { | ||
self.skipWaiting() | ||
}) | ||
|
||
self.addEventListener('activate', function (e) { | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.getRegistrations().then(function (registrations) { | ||
for (const registration of registrations) { | ||
registration.unregister() | ||
} | ||
}) | ||
} | ||
if ('caches' in window) { | ||
caches.keys() | ||
.then(function (keyList) { | ||
return Promise.all(keyList.map(function(key) { | ||
return caches.delete(key) | ||
})) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters