mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
源添加jsLib,未完成
This commit is contained in:
parent
4e7f2a52e5
commit
34789a22b7
@ -0,0 +1,18 @@
|
||||
package io.legado.app.help.rhino
|
||||
|
||||
import org.mozilla.javascript.Context
|
||||
|
||||
object RhinoScriptEngine {
|
||||
|
||||
|
||||
fun run(function: (Context) -> Any?): Any? {
|
||||
return try {
|
||||
val context = Context.enter()
|
||||
function.invoke(context)
|
||||
} finally {
|
||||
Context.exit()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -48,15 +48,6 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
||||
private val indexedProps: MutableMap<Any, Any?>
|
||||
private val implementor: InterfaceImplementor
|
||||
|
||||
fun run(function: (Context) -> Any?): Any? {
|
||||
return try {
|
||||
val context = Context.enter()
|
||||
function.invoke(context)
|
||||
} finally {
|
||||
Context.exit()
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(ScriptException::class)
|
||||
override fun eval(reader: Reader, scope: Scriptable): Any? {
|
||||
val cx = Context.enter()
|
||||
|
@ -48,15 +48,6 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
||||
private val indexedProps: MutableMap<Any, Any?>
|
||||
private val implementor: InterfaceImplementor
|
||||
|
||||
fun run(function: (Context) -> Any?): Any? {
|
||||
return try {
|
||||
val context = Context.enter()
|
||||
function.invoke(context)
|
||||
} finally {
|
||||
Context.exit()
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(ScriptException::class)
|
||||
override fun eval(reader: Reader, scope: Scriptable): Any? {
|
||||
val cx = Context.enter()
|
||||
|
Loading…
Reference in New Issue
Block a user