fix issue with repeating console input
This commit is contained in:
parent
531af6234b
commit
a231f11062
|
@ -28,9 +28,6 @@ class Console {
|
||||||
'The web3 object and the interfaces for the deployed contracts and their methods are also available'
|
'The web3 object and the interfaces for the deployed contracts and their methods are also available'
|
||||||
];
|
];
|
||||||
return helpText.join('\n');
|
return helpText.join('\n');
|
||||||
} else if (cmd === 'test') {
|
|
||||||
this.events.request("console:command", "help", () => {});
|
|
||||||
return "test";
|
|
||||||
} else if (['quit', 'exit', 'sair', 'sortir'].indexOf(cmd) >= 0) {
|
} else if (['quit', 'exit', 'sair', 'sortir'].indexOf(cmd) >= 0) {
|
||||||
utils.exit();
|
utils.exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,23 +344,27 @@ class Dashboard {
|
||||||
self.input.focus();
|
self.input.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.input.on('submit', this.executeCmd.bind(this));
|
this.input.on('submit', this.submitCmd.bind(this));
|
||||||
|
|
||||||
this.screen.append(this.consoleBox);
|
this.screen.append(this.consoleBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
submitCmd(cmd) {
|
||||||
|
if (cmd !== '') {
|
||||||
|
this.history.addCommand(cmd);
|
||||||
|
this.executeCmd(cmd);
|
||||||
|
}
|
||||||
|
this.input.clearValue();
|
||||||
|
this.input.focus();
|
||||||
|
}
|
||||||
|
|
||||||
executeCmd(cmd) {
|
executeCmd(cmd) {
|
||||||
const self = this;
|
const self = this;
|
||||||
if (cmd !== '') {
|
|
||||||
self.history.addCommand(cmd);
|
|
||||||
self.logText.log('console> '.bold.green + cmd);
|
self.logText.log('console> '.bold.green + cmd);
|
||||||
self.console.executeCmd(cmd, function (result) {
|
self.console.executeCmd(cmd, function (result) {
|
||||||
self.logText.log(result);
|
self.logText.log(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
self.input.clearValue();
|
|
||||||
self.input.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue