From a26d8a8a1bed48a77e062914c120a23ace7bb8cf Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 24 Feb 2019 20:54:35 +0900 Subject: Capitalize background scripts --- .../repositories/PersistentSettingRepository.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/background/repositories/PersistentSettingRepository.js (limited to 'src/background/repositories/PersistentSettingRepository.js') diff --git a/src/background/repositories/PersistentSettingRepository.js b/src/background/repositories/PersistentSettingRepository.js new file mode 100644 index 0000000..639bcd1 --- /dev/null +++ b/src/background/repositories/PersistentSettingRepository.js @@ -0,0 +1,16 @@ +import Setting from '../domains/Setting'; + +export default class SettingRepository { + save(settings) { + return browser.storage.local.set({ settings: settings.serialize() }); + } + + async load() { + let { settings } = await browser.storage.local.get('settings'); + if (!settings) { + return null; + } + return Setting.deserialize(settings); + } +} + -- cgit v1.2.3 From a880d5684b35235436f571e5fd8e9f857bf30434 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 24 Feb 2019 21:34:55 +0900 Subject: Remove unused methods --- src/background/repositories/PersistentSettingRepository.js | 4 ---- src/background/usecases/SettingUseCase.js | 4 ---- 2 files changed, 8 deletions(-) (limited to 'src/background/repositories/PersistentSettingRepository.js') diff --git a/src/background/repositories/PersistentSettingRepository.js b/src/background/repositories/PersistentSettingRepository.js index 639bcd1..4cab107 100644 --- a/src/background/repositories/PersistentSettingRepository.js +++ b/src/background/repositories/PersistentSettingRepository.js @@ -1,10 +1,6 @@ import Setting from '../domains/Setting'; export default class SettingRepository { - save(settings) { - return browser.storage.local.set({ settings: settings.serialize() }); - } - async load() { let { settings } = await browser.storage.local.get('settings'); if (!settings) { diff --git a/src/background/usecases/SettingUseCase.js b/src/background/usecases/SettingUseCase.js index fe3ca5d..9e17408 100644 --- a/src/background/usecases/SettingUseCase.js +++ b/src/background/usecases/SettingUseCase.js @@ -9,10 +9,6 @@ export default class SettingUseCase { this.settingRepository = new SettingRepository(); } - save(settings) { - this.persistentSettingRepository.save(settings); - } - get() { return this.settingRepository.get(); } -- cgit v1.2.3