mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Switch to asych/await where useful
This commit is contained in:
parent
372ee755f7
commit
10413a89c3
11 changed files with 269 additions and 349 deletions
|
@ -89,17 +89,13 @@
|
|||
};
|
||||
}();
|
||||
|
||||
browser.windows.onRemoved.addListener(function(){
|
||||
browser.windows.getAll().then(function(windows){
|
||||
if (windows.every(function(window){
|
||||
return !window.incognito;
|
||||
})){
|
||||
clearIncognito();
|
||||
}
|
||||
return;
|
||||
}).catch(function(error){
|
||||
logging.warning("Unable to get browser windows:", error);
|
||||
});
|
||||
browser.windows.onRemoved.addListener(async function(){
|
||||
const windows = await browser.windows.getAll();
|
||||
if (windows.every(function(window){
|
||||
return !window.incognito;
|
||||
})){
|
||||
clearIncognito();
|
||||
}
|
||||
});
|
||||
|
||||
function registerTimeout(){
|
||||
|
@ -117,14 +113,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
function broadcast(data){
|
||||
browser.tabs.query({}).then(function(tabs){
|
||||
tabs.forEach(function(tab){
|
||||
browser.tabs.sendMessage(tab.id, data);
|
||||
});
|
||||
return;
|
||||
}).catch(function(error){
|
||||
logging.warning("Unable to get browser tabs:", error);
|
||||
async function broadcast(data){
|
||||
const tabs = await browser.tabs.query({});
|
||||
tabs.forEach(function(tab){
|
||||
browser.tabs.sendMessage(tab.id, data);
|
||||
});
|
||||
}
|
||||
function clearIncognito(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue