Use references in key actions (#204)

This commit is contained in:
József Farkas
2016-12-13 23:09:39 +01:00
committed by GitHub
parent 3380a9d514
commit e48fdea89d
33 changed files with 266 additions and 255 deletions

View File

@@ -81,9 +81,16 @@ export class DataStorage {
}
initUHKJson() {
this.uhkConfiguration = new UhkConfiguration().fromJsObject(require('json!../../config-serializer/uhk-config.json'));
this.uhkConfiguration = new UhkConfiguration().fromJsonObject(require('json!../../config-serializer/uhk-config.json'));
this.uhkPresets = (<any[]>require('json!../../config-serializer/preset-keymaps.json'))
.map(keymap => new Keymap().fromJsObject(keymap));
/* TODO: Remove passing getters, because there shouldn't be any SwitchKeymapAction or PlayMacroAction in presets,
* so they shouldn't be needed.
*/
.map(keymap => new Keymap().fromJsonObject(
keymap,
this.uhkConfiguration.getKeymap.bind(this.uhkConfiguration),
this.uhkConfiguration.getMacro.bind(this.uhkConfiguration)
));
}
getConfiguration(): UhkConfiguration {

View File

@@ -11,7 +11,7 @@ export class Local {
if (configJsonString) {
const configJsonObject = JSON.parse(configJsonString);
if (configJsonObject.dataModelVersion === this.dataModelVersion) {
config = new UhkConfiguration().fromJsObject(configJsonObject);
config = new UhkConfiguration().fromJsonObject(configJsonObject);
}
}
@@ -19,6 +19,6 @@ export class Local {
}
saveConfig(config: UhkConfiguration): void {
localStorage.setItem('config', JSON.stringify(config.toJsObject()));
localStorage.setItem('config', JSON.stringify(config.toJsonObject()));
}
}