Browse Source
* Remove passing in main to notification as it's unused * Remove messages nothing reacts to * Shorten re-draw of badge and menu on logout * Remove windows.background and only listen to changes of tabs on focused window * Only rreact to tab changes of current active tab * Comments and console-logs * Removed comments and console.logs * Updated package-lock.json * Check if chrome.windows is available * Simplify check for active tabpull/2499/head
5 changed files with 24 additions and 38 deletions
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
import MainBackground from "./main.background"; |
||||
|
||||
export default class WindowsBackground { |
||||
private windows: any; |
||||
|
||||
constructor(private main: MainBackground) { |
||||
this.windows = chrome.windows; |
||||
} |
||||
|
||||
async init() { |
||||
if (!this.windows) { |
||||
return; |
||||
} |
||||
|
||||
this.windows.onFocusChanged.addListener(async (windowId: any) => { |
||||
if (windowId === null || windowId < 0) { |
||||
return; |
||||
} |
||||
|
||||
await this.main.refreshBadgeAndMenu(); |
||||
this.main.messagingService.send("windowFocused"); |
||||
this.main.messagingService.send("windowChanged"); |
||||
}); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue