Debounce updateAllTabsIcon

This commit is contained in:
eight 2018-10-04 19:39:59 +08:00
parent dc5f3e209f
commit 81e4823f46

View File

@ -150,11 +150,7 @@ prefs.subscribe([
'badgeDisabled', 'badgeDisabled',
'badgeNormal', 'badgeNormal',
'iconset', 'iconset',
], () => ], () => debounce(updateAllTabsIcon));
queryTabs().then(tabs =>
tabs.map(t => updateIcon({tab: t}))
)
);
// ************************************************************************* // *************************************************************************
chrome.runtime.onInstalled.addListener(({reason}) => { chrome.runtime.onInstalled.addListener(({reason}) => {
@ -534,3 +530,9 @@ function onRuntimeMessage(msg, sender, sendResponse) {
respond(result); respond(result);
} }
} }
function updateAllTabsIcon() {
return queryTabs().then(tabs =>
tabs.map(t => updateIcon({tab: t}))
);
}