Clear cache on relaod
This commit is contained in:
17
popup.js
17
popup.js
@@ -3,6 +3,7 @@
|
||||
const statusEl = document.getElementById("status");
|
||||
const listEl = document.getElementById("urlList");
|
||||
const openHistoryBtn = document.getElementById("openHistoryBtn");
|
||||
const clearBtn = document.getElementById("clearBtn");
|
||||
|
||||
function setStatus(message) {
|
||||
statusEl.textContent = message;
|
||||
@@ -153,6 +154,22 @@ openHistoryBtn.addEventListener("click", async () => {
|
||||
window.close();
|
||||
});
|
||||
|
||||
if (clearBtn) {
|
||||
clearBtn.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) {
|
||||
setStatus("Unable to clear captured samples.");
|
||||
return;
|
||||
}
|
||||
await loadCapturedUrls();
|
||||
setStatus("Captured samples cleared.");
|
||||
});
|
||||
}
|
||||
|
||||
loadCapturedUrls().catch(() => {
|
||||
setStatus("Unexpected error while loading URLs.");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user