From ec7ca22811567e6ffb7866793b0ba350bbb35233 Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 23 Feb 2024 18:31:56 +0000 Subject: [PATCH] Updated required Javascript features for chat. --- build.js | 2 +- src/mami-init.js/main.js | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/build.js b/build.js index cd7c1ef..24f35cf 100644 --- a/build.js +++ b/build.js @@ -54,7 +54,7 @@ if(!isDebugBuild) })); const swcJscOptions = { - target: 'es2021', + target: 'es2020', loose: false, externalHelpers: false, keepClassNames: true, diff --git a/src/mami-init.js/main.js b/src/mami-init.js/main.js index 8091c05..2b2f719 100644 --- a/src/mami-init.js/main.js +++ b/src/mami-init.js/main.js @@ -31,13 +31,8 @@ } try { - eval('const c = 1; let l = 2;'); - } catch(e) { - return false; - } - - try { - eval('for(const i of ["a", "b"]);'); + // this is eval'd to allow a parse exception to be thrown without cancelling the entire script + eval('for(const i of ["a", "b"]); let obj; obj?.test(); obj ??= {};'); } catch(e) { return false; }