mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-16 23:42:39 +01:00
Remove icon update coleascing
This commit is contained in:
parent
0217f1cc8b
commit
b9b8f739a0
@ -170,27 +170,27 @@ return asyncJobManager;
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
// Update visual of extension icon.
|
// Update visual of extension icon.
|
||||||
// A time out is used to coalesce adjacent requests to update badge.
|
|
||||||
|
|
||||||
µBlock.updateBadgeAsync = (function(){
|
µBlock.updateBadgeAsync = (function() {
|
||||||
var µb = µBlock;
|
var µb = µBlock, tabIdToUpdate;
|
||||||
|
|
||||||
// Cache callback definition, it was a bad idea to define this one inside
|
// Cache callback definition, it was a bad idea to define this one inside
|
||||||
// updateBadgeAsync
|
// updateBadgeAsync
|
||||||
var updateBadge = function(tabId) {
|
var updateBadge = function() {
|
||||||
var pageStore = µb.pageStoreFromTabId(tabId);
|
var pageStore = µb.pageStoreFromTabId(tabIdToUpdate);
|
||||||
if ( pageStore ) {
|
if ( pageStore ) {
|
||||||
pageStore.updateBadge();
|
pageStore.updateBadge();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vAPI.setIcon(tabId, 'off', '');
|
vAPI.setIcon(tabIdToUpdate, 'off', '');
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateBadgeAsync = function(tabId) {
|
var updateBadgeAsync = function(tabId) {
|
||||||
if ( vAPI.isBehindTheSceneTabId(tabId) ) {
|
if ( vAPI.isBehindTheSceneTabId(tabId) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
µb.asyncJobs.add('updateBadge-' + tabId, tabId, updateBadge, 0);
|
tabIdToUpdate = tabId;
|
||||||
|
setTimeout(updateBadge, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
return updateBadgeAsync;
|
return updateBadgeAsync;
|
||||||
|
Loading…
Reference in New Issue
Block a user