From 8ebe55f45735c03b8a7f8dfd946574b556d3efe6 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 22 Aug 2018 11:32:15 -0400 Subject: [PATCH] simple implementation of await --- lib/core/modules/coderunner/codeRunner.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/core/modules/coderunner/codeRunner.js b/lib/core/modules/coderunner/codeRunner.js index c34af412..95bc5b40 100644 --- a/lib/core/modules/coderunner/codeRunner.js +++ b/lib/core/modules/coderunner/codeRunner.js @@ -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});