Clear cache on relaod
This commit is contained in:
17
history.js
17
history.js
@@ -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.";
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user