blob: 2006965a3b877f4cdf0b4528ff6c7ff280c6978a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { injectable, inject } from "tsyringe";
import ContentMessageListener from "./infrastructures/ContentMessageListener";
import SettingController from "./controllers/SettingController";
import VersionController from "./controllers/VersionController";
import SettingRepository from "./repositories/SettingRepository";
import FindRepositoryImpl from "./repositories/FindRepository";
@injectable()
export default class Application {
constructor(
private contentMessageListener: ContentMessageListener,
private settingController: SettingController,
private versionController: VersionController,
@inject("SyncSettingRepository")
private syncSettingRepository: SettingRepository,
@inject("FindRepository")
private readonly findRepository: FindRepositoryImpl
) {}
run() {
this.settingController.reload();
browser.tabs.onUpdated.addListener((tabId: number, info) => {
if (info.status == "loading") {
this.findRepository.deleteLocalState(tabId);
}
});
browser.runtime.onInstalled.addListener((details) => {
if (details.reason !== "install" && details.reason !== "update") {
return;
}
this.versionController.notify();
});
this.contentMessageListener.run();
this.syncSettingRepository.onChange(() => {
this.settingController.reload();
});
}
}
|