pengwei1024 / JsBridge

A simpler, extendable bidirectional communication Frame between Android WebView and Javascript
https://github.com/pengwei1024/JsBridge/wiki
Apache License 2.0
643 stars 88 forks source link

window.onJsBridgeReady 回调好多次怎么破? #35

Open MaXiaopingIT opened 3 years ago

MaXiaopingIT commented 3 years ago

console.log("window.onJsBridgeReady = function () {") window.onJsBridgeReady = function () { console.log("window.onJsBridgeReady") JsBridge.mp.getCurrentUser({ success: data => { console.log("JsBridge.mp.getCurrentUser") console.log(data) // resolve(JSON.parse(data)) }, error: (err) => { console.log(err) // reject(err) } }) // mp.getCurrentUser().then(res=>{ // console.log("返回的东西") // console.log(res) // }) }

pengwei1024 commented 3 years ago

你说 onJsBridgeReady 方法回调多次吗?还是 getCurrentUser ?前者的话可以用全局变量控制下,后者得看端上是不是多次调用了