From 9a15a0ab1ff31cf1db898249d5fe728b4b0bd2d4 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Mon, 11 May 2020 10:20:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9EdefineProperty?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MiaoWoo --- pom.xml | 2 +- src/main/resources/core/ployfill.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index eb27782..c8a968f 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 pw.yumc MiaoScript - 0.6.0 + 0.6.5 502647092 diff --git a/src/main/resources/core/ployfill.js b/src/main/resources/core/ployfill.js index 725fe9d..ebd40bd 100644 --- a/src/main/resources/core/ployfill.js +++ b/src/main/resources/core/ployfill.js @@ -11,7 +11,14 @@ global.engineLoad = load; global.noop = global.engineDisable = engineDisable = function () { }; global.load = load = function __PreventGlobalLoadFunction__() { throw new Error('Internal engine system not allow use `load` function!'); } - global.setGlobal = function (key, value) { global[key] = value; }; + global.setGlobal = function (key, value, config) { + if (config) { + config.value = value; + Object.defineProperty(global, key, config) + } else { + global[key] = value; + } + }; // Init console and require global.console = engineLoad('classpath:core/console.js')(logger); console.log("Loading Engine at Thread", java.lang.Thread.currentThread().name)