diff --git a/background.js b/background.js index c225691..ada17fa 100644 --- a/background.js +++ b/background.js @@ -17,7 +17,8 @@ let bgOpts; function registerHandlers() { if (bgOpts.autorun.updated) { chrome.tabs.onUpdated.addListener((tabId, info, tab) => { - autoFind(tabId, tab.url); + removeBadge(tabId) + .then(() => autoFind(tabId, tab.url)); }); } @@ -100,6 +101,10 @@ function setResultsBadge(tabId, text) { return setBadge(tabId, text, BADGE_COLORS.success); } +function removeBadge(tabId) { + return setResultsBadge(tabId, ''); +} + function setBadge(tabId, text, color) { let badge = { text: text, tabId: tabId }; let bgCol = { color: color, tabId: tabId };