Make Keymap class

This commit is contained in:
Shin'ya UEOKA 2019-10-04 04:01:35 +00:00
parent b496cea582
commit 410ffbb037
15 changed files with 223 additions and 129 deletions

View file

@ -1,6 +1,6 @@
import { injectable } from 'tsyringe';
import MemoryStorage from '../infrastructures/MemoryStorage';
import Settings from '../../shared/Settings';
import Settings, { valueOf, toJSON } from '../../shared/Settings';
import * as PropertyDefs from '../../shared/property-defs';
const CACHED_SETTING_KEY = 'setting';
@ -14,11 +14,13 @@ export default class SettingRepository {
}
get(): Promise<Settings> {
return Promise.resolve(this.cache.get(CACHED_SETTING_KEY));
let data = this.cache.get(CACHED_SETTING_KEY);
return Promise.resolve(valueOf(data));
}
update(value: Settings): void {
return this.cache.set(CACHED_SETTING_KEY, value);
let data = toJSON(value);
return this.cache.set(CACHED_SETTING_KEY, data);
}
async setProperty(