mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-12-30 12:01:50 +01:00
Remove service worker (#227)
* Script for removing service worker * Clean-up * Return out if there is no registrations * Check if browser support service worker
This commit is contained in:
parent
bb7b160234
commit
1f1b2cd125
@ -18,6 +18,7 @@ module.exports = {
|
||||
// Custom headers
|
||||
["link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin:""}],
|
||||
["link", { rel: "stylesheet", href: "https://fonts.googleapis.com/css?family=Open+Sans"}],
|
||||
["script", {src: "/scripts/remove_service_worker.js"}]
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
|
13
src/.vuepress/public/scripts/remove_service_worker.js
Normal file
13
src/.vuepress/public/scripts/remove_service_worker.js
Normal file
@ -0,0 +1,13 @@
|
||||
if ("serviceWorker" in navigator) {
|
||||
console.log("Checking for service worker...");
|
||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||
if (registrations.length < 1) {
|
||||
console.log("Found no service worker!");
|
||||
return;
|
||||
}
|
||||
registrations.forEach((registration) => {
|
||||
registration.unregister();
|
||||
console.log("Removed service worker!");
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user