From 3321ab23c22a2c1dcc8297fe83d16c7ee2420050 Mon Sep 17 00:00:00 2001 From: lizhi Date: Fri, 17 Dec 2021 16:14:18 +0800 Subject: [PATCH] add two function --- .../java/org/bdware/sc/engine/DesktopEngine.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bdware/sc/engine/DesktopEngine.java b/src/main/java/org/bdware/sc/engine/DesktopEngine.java index 7446bfa..c0279dd 100644 --- a/src/main/java/org/bdware/sc/engine/DesktopEngine.java +++ b/src/main/java/org/bdware/sc/engine/DesktopEngine.java @@ -226,6 +226,18 @@ public class DesktopEngine extends JSEngine { } } + public Object invokeFunction(String functionName, Object... args) { + Invocable cal = engine; + try { + return cal.invokeFunction(functionName, args); + } catch (ScriptException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } + return null; + } + public Resources getResources() { return this.resources; } @@ -404,10 +416,11 @@ public class DesktopEngine extends JSEngine { } } - private void compileFunction(String snippet, boolean instrumentBranch) throws ScriptException { + public void compileFunction(String snippet, boolean instrumentBranch) throws ScriptException { compileFunction((ScriptObjectMirror) engine.eval(snippet), instrumentBranch); } + @Override public synchronized ContractResult executeContract(ContractRequest input) { ContractProcess.Logger previous = this.getTracePS();