clearing all caches

This commit is contained in:
Miodec 2022-01-15 20:34:53 +01:00
parent f64660174d
commit 4486d2348c
2 changed files with 10 additions and 3 deletions

View file

@ -3060,7 +3060,10 @@ export let defaultCommands = {
display: "Clear SW cache",
icon: "fa-cog",
exec: async () => {
await caches.delete("sw-cache");
let caches = await caches.keys();
for (let name of caches) {
caches.delete(name);
}
window.location.reload(true);
},
},

View file

@ -19,10 +19,14 @@ export async function show(version) {
window.location.hostname === "localhost" ||
window.location.hostname === "127.0.0.1"
) {
caches.delete("sw-cache");
caches.keys().then(function (names) {
for (let name of names) caches.delete(name);
});
}
if (memory === version) return;
caches.delete("sw-cache");
caches.keys().then(function (names) {
for (let name of names) caches.delete(name);
});
Notifications.addBanner(
`Version ${version} has been released. Click the version number in the bottom right to view the changelog.`,
1,