From 3bf1cf8c94ce8b7bbb9fccd02240a817349dbfcf Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 28 May 2024 01:57:34 -0400 Subject: [PATCH] fix(scenes): replace `eval` with `new Function` https://exploringjs.com/impatient-js/ch_dynamic-code-evaluation.html --- src/scenes/game.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scenes/game.ts b/src/scenes/game.ts index f646e0a..175b951 100644 --- a/src/scenes/game.ts +++ b/src/scenes/game.ts @@ -31,7 +31,8 @@ export function initGameScene() { initGame() level.prescript() const script = editorView.state.doc.toString() - eval(script) + const fun = new Function(script) + fun() level.postscript() }