refactored keyboard actions into commands

This commit is contained in:
zadam
2020-02-16 19:54:11 +01:00
parent 880f4ad711
commit a679fedb58
14 changed files with 125 additions and 127 deletions

View File

@@ -42,14 +42,12 @@ class AppContext extends Component {
this.triggerEvent(eventName);
});
this.children = [
this.tabManager,
rootWidget,
new Entrypoints(this)
];
this.children = [ rootWidget ];
this.executors = [
new DialogCommandExecutor(this)
this.tabManager,
new DialogCommandExecutor(this),
new Entrypoints(this)
];
if (utils.isElectron()) {
@@ -67,9 +65,7 @@ class AppContext extends Component {
async triggerCommand(name, data = {}) {
for (const executor of this.executors) {
const fun = executor[name + 'Command'];
const called = await this.callMethod(executor, fun, data);
const called = await executor.handleCommand(name, data);
if (called) {
return;