aboutsummaryrefslogtreecommitdiff
path: root/src/background/Application.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-02-09 13:43:37 +0900
committerGitHub <noreply@github.com>2020-02-09 13:43:37 +0900
commite9f81d2e2494396bc9ebd827ab02aa8128f1a3ac (patch)
treec6382665c547443358163cb7cbaeeaba52d688b3 /src/background/Application.ts
parent8b9388f6e60fe67d20638f55aecb0ed1b281871a (diff)
parentb2fc46ebf79ebb1ffa068fb513d1eeb9b50d7b3f (diff)
Merge pull request #708 from ueokande/sync-storage
Synchronize settings with Firefox Sync
Diffstat (limited to 'src/background/Application.ts')
-rw-r--r--src/background/Application.ts13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/background/Application.ts b/src/background/Application.ts
index 08013cd..c2c48b5 100644
--- a/src/background/Application.ts
+++ b/src/background/Application.ts
@@ -1,7 +1,8 @@
-import { injectable } from 'tsyringe';
+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";
@injectable()
export default class Application {
@@ -9,6 +10,7 @@ export default class Application {
private contentMessageListener: ContentMessageListener,
private settingController: SettingController,
private versionController: VersionController,
+ @inject("SyncSettingRepository") private syncSettingRepository: SettingRepository,
) {
}
@@ -23,13 +25,8 @@ export default class Application {
});
this.contentMessageListener.run();
- browser.storage.onChanged.addListener((changes, area) => {
- if (area !== 'local') {
- return;
- }
- if (changes.settings) {
- this.settingController.reload();
- }
+ this.syncSettingRepository.onChange(() => {
+ this.settingController.reload();
});
}
}