Settings as clean architecture
This commit is contained in:
parent
0652131de8
commit
89c28d67fd
11 changed files with 176 additions and 33 deletions
17
src/background/repositories/setting.js
Normal file
17
src/background/repositories/setting.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import MemoryStorage from '../infrastructures/memory-storage';
|
||||
|
||||
const CACHED_SETTING_KEY = 'setting';
|
||||
|
||||
export default class SettingRepository {
|
||||
constructor() {
|
||||
this.cache = new MemoryStorage();
|
||||
}
|
||||
|
||||
get() {
|
||||
return Promise.resolve(this.cache.get(CACHED_SETTING_KEY));
|
||||
}
|
||||
|
||||
update(value) {
|
||||
return this.cache.set(CACHED_SETTING_KEY, value);
|
||||
}
|
||||
}
|
Reference in a new issue