Added types: Use chrome.tabs instead of any

This commit is contained in:
Daniel James Smith 2021-10-18 18:02:19 +02:00
parent 9c10961b9f
commit 06e47dea17
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726
1 changed files with 4 additions and 7 deletions

View File

@ -1,24 +1,21 @@
import MainBackground from './main.background'; import MainBackground from './main.background';
export default class TabsBackground { export default class TabsBackground {
private tabs: any;
constructor(private main: MainBackground) { constructor(private main: MainBackground) {
this.tabs = chrome.tabs;
} }
async init() { async init() {
if (!this.tabs) { if (!chrome.tabs) {
return; return;
} }
this.tabs.onActivated.addListener(async (activeInfo: any) => { chrome.tabs.onActivated.addListener(async (activeInfo: chrome.tabs.TabActiveInfo) => {
await this.main.refreshBadgeAndMenu(); await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('tabActivated'); this.main.messagingService.send('tabActivated');
this.main.messagingService.send('tabChanged'); this.main.messagingService.send('tabChanged');
}); });
this.tabs.onReplaced.addListener(async (addedTabId: any, removedTabId: any) => { chrome.tabs.onReplaced.addListener(async (addedTabId: number, removedTabId: number) => {
if (this.main.onReplacedRan) { if (this.main.onReplacedRan) {
return; return;
} }
@ -29,7 +26,7 @@ export default class TabsBackground {
this.main.messagingService.send('tabChanged'); this.main.messagingService.send('tabChanged');
}); });
this.tabs.onUpdated.addListener(async (tabId: any, changeInfo: any, tab: any) => { chrome.tabs.onUpdated.addListener(async (tabId: number, changeInfo: chrome.tabs.TabChangeInfo, tab: chrome.tabs.Tab) => {
if (this.main.onUpdatedRan) { if (this.main.onUpdatedRan) {
return; return;
} }