mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 18:39:27 -05:00
Fix small bug with async code snippets
If a code snippet used await, and had a line comment on the last line, it would fail to run: ```js await sleep(1000); show_json(100); // show_json(200); ``` This is because the line comment would end up cutting off the end of the async function wrapper that `code_eval` creates.
This commit is contained in:
+1
-1
@@ -1663,7 +1663,7 @@ function code_eval(snippet)
|
||||
{
|
||||
var f="eval";
|
||||
if(snippet.search("output=")!=-1 || snippet.search("json_output=")!=-1) f="eval_s";
|
||||
if(snippet.search("await")!=-1) snippet="(async () => {"+snippet+"})()";
|
||||
if(snippet.search("await")!=-1) snippet="(async () => {"+snippet+"\n})()";
|
||||
if(code_active)
|
||||
{
|
||||
call_code_function(f,snippet);
|
||||
|
||||
Reference in New Issue
Block a user