Allow top level await
This commit is contained in:
8
index.ts
8
index.ts
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user