Make settings as a clean architecture
This commit is contained in:
parent
e76ca380f7
commit
bacf83a320
16 changed files with 223 additions and 196 deletions
22
src/content/repositories/SettingRepository.ts
Normal file
22
src/content/repositories/SettingRepository.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Settings, { DefaultSetting } from '../../shared/Settings';
|
||||
|
||||
let current: Settings = DefaultSetting;
|
||||
|
||||
export default interface SettingRepository {
|
||||
set(setting: Settings): void;
|
||||
|
||||
get(): Settings;
|
||||
|
||||
// eslint-disable-next-line semi
|
||||
}
|
||||
|
||||
export class SettingRepositoryImpl implements SettingRepository {
|
||||
set(setting: Settings): void {
|
||||
current = setting;
|
||||
}
|
||||
|
||||
get(): Settings {
|
||||
return current;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue