mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
separating background apis to their own classes
This commit is contained in:
23
src/background/windows.background.ts
Normal file
23
src/background/windows.background.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user