Skip to content

Commit

Permalink
remove old badge on page url update
Browse files Browse the repository at this point in the history
  • Loading branch information
AdeelH committed Apr 3, 2017
1 parent d112e9e commit 513a344
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}

Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit 513a344

Please sign in to comment.