diff options
author | Shin'ya UEOKA <ueokande@i-beam.org> | 2019-10-05 07:19:48 +0000 |
---|---|---|
committer | Shin'ya UEOKA <ueokande@i-beam.org> | 2019-10-06 12:58:59 +0000 |
commit | 0dec6c641fc11348f89a12680a087ccda1181f66 (patch) | |
tree | add5914f55801e346dd55eb1a7bacc44f6086f8a /src/background/repositories | |
parent | b86b4680b6c2a3f0cceefaaf7c2e35417ec555df (diff) |
Make Settings class
Diffstat (limited to 'src/background/repositories')
-rw-r--r-- | src/background/repositories/SettingRepository.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/background/repositories/SettingRepository.ts b/src/background/repositories/SettingRepository.ts index a11b65f..e775a32 100644 --- a/src/background/repositories/SettingRepository.ts +++ b/src/background/repositories/SettingRepository.ts @@ -1,6 +1,6 @@ import { injectable } from 'tsyringe'; import MemoryStorage from '../infrastructures/MemoryStorage'; -import Settings, { valueOf, toJSON } from '../../shared/Settings'; +import Settings from '../../shared/settings/Settings'; import Properties from '../../shared/settings/Properties'; const CACHED_SETTING_KEY = 'setting'; @@ -15,12 +15,11 @@ export default class SettingRepository { get(): Promise<Settings> { let data = this.cache.get(CACHED_SETTING_KEY); - return Promise.resolve(valueOf(data)); + return Promise.resolve(Settings.fromJSON(data)); } update(value: Settings): void { - let data = toJSON(value); - return this.cache.set(CACHED_SETTING_KEY, data); + return this.cache.set(CACHED_SETTING_KEY, value.toJSON()); } async setProperty( |