import { makeObservable , observable } from 'mobx' ; import type { ISettingsSource } from './ISettingsSource' ; export class SettingsSource implements ISettingsSource { protected store = new Map < string , any > ( ) ; constructor ( protected fallback ? ) { makeObservable < this , 'store' > ( this , { store : observable , } ) ; } has ( key ) { return this . store . has ( key ) || ! ! this . fallback ?. has ( key ) ; } getValue ( key ) { if ( this . fallback ?. has ( key ) ) { return this . fallback . getValue ( key ) ; } return this . store . get ( key ) ; } setValue ( key , value ) { this . store . set ( key , value ) ; } clear ( ) { this . store . clear ( ) ; } }