Add JavaScriptEngine abstraction to extensions-lib (#9)

This commit is contained in:
arkon 2022-10-08 09:45:10 -04:00 committed by GitHub
parent 7be52d2c4c
commit 71fe20d3b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,19 @@
package eu.kanade.tachiyomi.network
import android.content.Context
/**
* Util for evaluating JavaScript in sources.
*/
class JavaScriptEngine(context: Context) {
/**
* Evaluate arbitrary JavaScript code and get the result as a primtive type
* (e.g., String, Int).
*
* @since extensions-lib 1.4
* @param script JavaScript to execute.
* @return Result of JavaScript code as a primitive type.
*/
suspend fun <T> evaluate(script: String): T = throw Exception("Stub!")
}