Use references in key actions (#204)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user