Allow top level await

This commit is contained in:
dylan
2023-05-16 23:45:29 -07:00
parent 9cb77c7d59
commit 9b48560cce
2 changed files with 11 additions and 8 deletions

View File

@@ -17,9 +17,9 @@ let game: any = null;
let mode: "play" | "edit" | "repl" = "repl";
addToContext("play", () => {
addToContext("play", async () => {
game = await runCode(getCodeSheet(0));
mode = "play";
game = runCode(getCodeSheet(0));
game.init();
});
@@ -43,8 +43,8 @@ await mainloop(async (_t) => {
} else {
if (mode === "play") {
if (game) {
game.update();
game.draw();
await game.update();
await game.draw();
}
frame();
} else if (mode === "repl") {