Skip to content

Commit

Permalink
Debounce updateAllTabsIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Oct 4, 2018
1 parent dc5f3e2 commit 81e4823
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions background/background.js
Expand Up @@ -150,11 +150,7 @@ prefs.subscribe([
'badgeDisabled',
'badgeNormal',
'iconset',
], () =>
queryTabs().then(tabs =>
tabs.map(t => updateIcon({tab: t}))
)
);
], () => debounce(updateAllTabsIcon));

// *************************************************************************
chrome.runtime.onInstalled.addListener(({reason}) => {
Expand Down Expand Up @@ -534,3 +530,9 @@ function onRuntimeMessage(msg, sender, sendResponse) {
respond(result);
}
}

function updateAllTabsIcon() {
return queryTabs().then(tabs =>
tabs.map(t => updateIcon({tab: t}))
);
}

0 comments on commit 81e4823

Please sign in to comment.