Merge pull request #23 from vtrayy/vtrayy-patch-1
Some checks failed
Android CI / build (push) Has been cancelled

修复java基本类型映射到js变为包装类型 #21
This commit is contained in:
TonyJiangWJ 2025-08-23 07:36:36 +08:00 committed by GitHub
commit 2fd2cd000e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -205,10 +205,12 @@ open class RhinoJavaScriptEngine(private val mAndroidContext: android.content.Co
}
private inner class WrapFactory : org.mozilla.javascript.WrapFactory() {
init {
isJavaPrimitiveWrap = false
}
override fun wrap(cx: Context, scope: Scriptable, obj: Any?, staticType: Class<*>?): Any? {
return when {
obj is String -> runtime.bridges.toString(obj.toString())
staticType == UiObjectCollection::class.java -> runtime.bridges.asArray(obj)
else -> {
if (scope is TopLevelScope) {