setBadgeText has a callback in Chrome 67+
This commit is contained in:
parent
5174e7481f
commit
8524c76f66
|
@ -409,8 +409,12 @@ function updateIcon({tab, styles}) {
|
||||||
chrome.browserAction.setBadgeBackgroundColor({color});
|
chrome.browserAction.setBadgeBackgroundColor({color});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tabIcon.text !== text) {
|
if (tabIcon.text === text) return;
|
||||||
tabIcon.text = text;
|
tabIcon.text = text;
|
||||||
|
try {
|
||||||
|
// Chrome supports the callback since 67.0.3381.0, see https://crbug.com/451320
|
||||||
|
chrome.browserAction.setBadgeText({text, tabId: tab.id}, ignoreChromeError);
|
||||||
|
} catch (e) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getTab(tab.id).then(realTab => {
|
getTab(tab.id).then(realTab => {
|
||||||
// skip pre-rendered tabs
|
// skip pre-rendered tabs
|
||||||
|
|
Loading…
Reference in New Issue
Block a user