mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-02 03:41:09 +01:00
24 lines
528 B
TypeScript
24 lines
528 B
TypeScript
|
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();
|
||
|
});
|
||
|
}
|
||
|
}
|