You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An Android bridge for sending messages between Java and JavaScript in WebViews. Based on [IOS marcuswestin/WebViewJavascriptBridge](https://github.com/marcuswestin/WebViewJavascriptBridge).
8
8
@@ -30,7 +30,7 @@ See the `app/` folder.
30
30
Usage
31
31
-----
32
32
33
-
1)
33
+
1)Init WebViewJavaScriptBridge
34
34
35
35
```java
36
36
WebSettings settings = webView.getSettings();
@@ -66,44 +66,44 @@ mBridge.callHandler("NativeCallJS", model.toJSON(), new WebViewJavaScriptBridgeB
66
66
67
67
```javascript
68
68
functionsetupWebViewJavascriptBridge(callback) {
69
-
if(window.WebViewJavascriptBridge) {
70
-
returncallback(WebViewJavascriptBridge);
71
-
}
72
-
if(window.WVJBCallbacks) {
73
-
returnwindow.WVJBCallbacks.push(callback);
74
-
}
75
-
window.WVJBCallbacks= [callback];
76
-
var WVJBIframe =document.createElement('iframe');
77
-
WVJBIframe.style.display='none';
78
-
WVJBIframe.src='wvjbscheme://__BRIDGE_LOADED__';
79
-
document.documentElement.appendChild(WVJBIframe);
80
-
setTimeout(function() {
81
-
document.documentElement.removeChild(WVJBIframe)
82
-
}, 0);
69
+
if(window.WebViewJavascriptBridge) {
70
+
returncallback(WebViewJavascriptBridge);
71
+
}
72
+
if(window.WVJBCallbacks) {
73
+
returnwindow.WVJBCallbacks.push(callback);
74
+
}
75
+
window.WVJBCallbacks= [callback];
76
+
var WVJBIframe =document.createElement('iframe');
77
+
WVJBIframe.style.display='none';
78
+
WVJBIframe.src='wvjbscheme://__BRIDGE_LOADED__';
79
+
document.documentElement.appendChild(WVJBIframe);
80
+
setTimeout(function() {
81
+
document.documentElement.removeChild(WVJBIframe)
82
+
}, 0);
83
83
}
84
84
```
85
85
86
86
5) Finally, call `setupWebViewJavascriptBridge` and then use the bridge to register handlers and call Java handlers:
0 commit comments