add two function

This commit is contained in:
lizhi 2021-12-17 16:14:18 +08:00
parent d3cddb1773
commit 3321ab23c2

View File

@ -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();