fix: engineDisable override
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
7e36b6109d
commit
40760713ff
@ -17,18 +17,16 @@ public class ScriptEngine {
|
|||||||
private Object logger;
|
private Object logger;
|
||||||
private Base base;
|
private Base base;
|
||||||
private MiaoScriptEngine engine;
|
private MiaoScriptEngine engine;
|
||||||
private ScriptEngineManager manager;
|
|
||||||
|
|
||||||
public ScriptEngine(String root, Object logger, Object instance) {
|
public ScriptEngine(String root, Object logger, Object instance) {
|
||||||
this.root = root;
|
this.root = root;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.base = new Base(instance);
|
this.base = new Base(instance);
|
||||||
this.manager = new ScriptEngineManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized MiaoScriptEngine createEngine() {
|
public synchronized MiaoScriptEngine createEngine() {
|
||||||
if (this.engine == null) {
|
if (this.engine == null) {
|
||||||
this.engine = new MiaoScriptEngine(manager, "nashorn");
|
this.engine = new MiaoScriptEngine(new ScriptEngineManager(), "nashorn");
|
||||||
this.engine.put("base", this.base);
|
this.engine.put("base", this.base);
|
||||||
this.engine.put("ScriptEngineContextHolder", this);
|
this.engine.put("ScriptEngineContextHolder", this);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
global.logger = logger;
|
global.logger = logger;
|
||||||
global.ScriptEngineStartTime = new Date().getTime()
|
global.ScriptEngineStartTime = new Date().getTime()
|
||||||
global.engineLoad = load;
|
global.engineLoad = load;
|
||||||
global.noop = global.engineDisable = engineDisable = function () { };
|
global.noop = function () { };
|
||||||
global.load = load = function __PreventGlobalLoadFunction__() { throw new Error('Internal engine system not allow use `load` function!'); }
|
global.load = load = function __PreventGlobalLoadFunction__() { throw new Error('Internal engine system not allow use `load` function!'); }
|
||||||
global.setGlobal = function (key, value, config) {
|
global.setGlobal = function (key, value, config) {
|
||||||
if (config) {
|
if (config) {
|
||||||
|
Loading…
Reference in New Issue
Block a user