2017-12-07 21:06:37 +01:00
|
|
|
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();
|
2020-08-24 16:17:15 +02:00
|
|
|
this.main.messagingService.send("windowFocused");
|
|
|
|
this.main.messagingService.send("windowChanged");
|
2017-12-07 21:06:37 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|