mirror of https://github.com/embarklabs/embark.git
simple implementation of await
This commit is contained in:
parent
b4e118c85b
commit
8ebe55f457
|
@ -41,6 +41,10 @@ class CodeRunner {
|
|||
if (!cb) {
|
||||
cb = function() {};
|
||||
}
|
||||
if (code.startsWith('await')) {
|
||||
code = code.substring(5); // remove await keyword
|
||||
code += '.then(console.log).catch(console.error)'; // Add promise catch
|
||||
}
|
||||
let result = RunCode.doEval(code);
|
||||
if (forConsoleOnly && self.ipc.isServer()) {
|
||||
self.commands.push({code});
|
||||
|
|
Loading…
Reference in New Issue