Skip to content

只是为了更方便的在 Kotlin 中使用 JSBridge,也更好的支持了 Tencent X5 浏览器内核

Notifications You must be signed in to change notification settings

zhangls2014/JSBridge

Repository files navigation

JSBridge

由于项目中使用的 JSBridge 库长期不维护,出现了未解决的 bug,所以决定使用 kotlin 重写一次。

Android 上的使用方法

  1. Android 调用 JS 方法

    BridgeWebView.callHandler("functionName", "data") {
      // 回调内容
    }
  2. 注册 JS 调用 Android 方法

    BridgeWebView.registerHandler("functionName") { "data", callback ->
      // 回调内容
    }

X5BridgeWebView

X5BridgeWebView 基于 Tbs (腾讯浏览服务) X5 内核,如需使用需要引入 Tbs 的依赖。

WebViewClient

setWebViewClient 方法被标记过时,需要使用 setJSWebViewClient 替代

集成方法

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

dependencies {
  implementation 'com.github.zhangls2014:JSBridge:Tag'
}

About

只是为了更方便的在 Kotlin 中使用 JSBridge,也更好的支持了 Tencent X5 浏览器内核

Resources

Stars

Watchers

Forks

Packages

No packages published