Clear cache on relaod

This commit is contained in:
2026-08-05 23:36:34 -05:00
parent 49bc022909
commit 1fb42334ae
9 changed files with 103 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
const statusEl = document.getElementById("status");
const listEl = document.getElementById("historyList");
const clearHistoryBtn = document.getElementById("clearHistoryBtn");
function formatMeta(entry) {
const packName = entry && entry.packName ? entry.packName : "n/a";
@@ -140,3 +141,19 @@ async function loadHistory() {
loadHistory().catch(() => {
statusEl.textContent = "Unexpected error while loading history.";
});
if (clearHistoryBtn) {
clearHistoryBtn.addEventListener("click", async () => {
const confirmed = window.confirm("Clear all captured samples and history?");
if (!confirmed) {
return;
}
const result = await browser.runtime.sendMessage({ type: "CLEAR_CAPTURED_STATE" });
if (!result || !result.ok) {
statusEl.textContent = "Unable to clear captured samples.";
return;
}
await loadHistory();
statusEl.textContent = "Captured samples cleared.";
});
}