This commit is contained in:
kunfei
2023-07-29 00:25:04 +08:00
parent 88a6d6d7be
commit c9b96f0fa7
7 changed files with 88 additions and 65 deletions

View File

@@ -48,6 +48,12 @@ object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
private val indexedProps: MutableMap<Any, Any?>
private val implementor: InterfaceImplementor
fun eval(js: String, bindingsConfig: SimpleBindings.() -> Unit = {}): Any? {
val bindings = SimpleBindings()
bindings.apply(bindingsConfig)
return eval(js, bindings)
}
@Throws(ScriptException::class)
override fun eval(reader: Reader, scope: Scriptable): Any? {
val cx = Context.enter()