From f961c205a7afbcbfc4cc585fbb0362796043f1a1 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Fri, 15 Feb 2019 21:01:12 +0900 Subject: Use onInstalled event --- src/background/controllers/VersionController.js | 4 ++-- src/background/controllers/version.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/background/controllers/version.js (limited to 'src/background/controllers') diff --git a/src/background/controllers/VersionController.js b/src/background/controllers/VersionController.js index 1bcac4c..c596f9b 100644 --- a/src/background/controllers/VersionController.js +++ b/src/background/controllers/VersionController.js @@ -5,7 +5,7 @@ export default class VersionController { this.versionUseCase = new VersionUseCase(); } - notifyIfUpdated() { - this.versionUseCase.notifyIfUpdated(); + notify() { + this.versionUseCase.notify(); } } diff --git a/src/background/controllers/version.js b/src/background/controllers/version.js new file mode 100644 index 0000000..ec0f634 --- /dev/null +++ b/src/background/controllers/version.js @@ -0,0 +1,13 @@ +import VersionInteractor from '../usecases/version'; + +export default class VersionController { + constructor() { + this.versionInteractor = new VersionInteractor(); + } + + notifyIfUpdated() { + browser.runtime.onInstalled.addListener(() => { + return this.versionInteractor.notify(); + }); + } +} -- cgit v1.2.3