mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-16 21:37:06 +02:00
web/storage: move clearCacheStorage() logic to clear button
This commit is contained in:
parent
54ec1645fe
commit
b3f151f3cb
@ -2,7 +2,7 @@
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { createDialog } from "$lib/state/dialogs";
|
||||
import { clearQueue } from "$lib/state/task-manager/queue";
|
||||
import { clearCacheStorage, clearFileStorage } from "$lib/storage";
|
||||
import { clearFileStorage } from "$lib/storage";
|
||||
|
||||
import IconFileShredder from "@tabler/icons-svelte/IconFileShredder.svelte";
|
||||
import DataSettingsButton from "$components/settings/DataSettingsButton.svelte";
|
||||
@ -28,7 +28,10 @@
|
||||
action: async () => {
|
||||
clearQueue();
|
||||
await clearFileStorage();
|
||||
await clearCacheStorage();
|
||||
if ('caches' in window) {
|
||||
const keys = await caches.keys();
|
||||
await Promise.all(keys.map(key => caches.delete(key)));
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -65,14 +65,6 @@ export const clearFileStorage = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
export const clearCacheStorage = async () => {
|
||||
const keys = await caches.keys();
|
||||
|
||||
for (const key of keys) {
|
||||
caches.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
export const getStorageQuota = async () => {
|
||||
let estimate;
|
||||
if (navigator.storage.estimate) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user