blob: 656fc3fdec2cbd98e8310af8d6655bb81a4557b6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import Setting from '../domains/setting';
import PersistentSettingRepository from '../repositories/persistent-setting';
import SettingRepository from '../repositories/setting';
export default class SettingInteractor {
constructor() {
this.persistentSettingRepository = new PersistentSettingRepository();
this.settingRepository = new SettingRepository();
}
save(settings) {
this.persistentSettingRepository.save(settings);
}
get() {
return this.settingRepository.get();
}
async reload() {
let settings = await this.persistentSettingRepository.load();
if (!settings) {
settings = Setting.defaultSettings();
}
let value = settings.value();
this.settingRepository.update(value);
return value;
}
}
|