22
33-----
44
5- inspired and modified from [ this] ( https://github.com/jacin1/JsBridge ) and wechat jsBridge file, with some bugs fix and feature enhancement .
5+ Inspired and modified from [ this] ( https://github.com/jacin1/JsBridge ) and WeChat jsBridge file, with some bug fixes and feature enhancements .
66
7- This project make a bridge between Java and JavaScript.
7+ This project makes a bridge between Java and JavaScript.
88
9- It provides safe and convenient way to call Java code from js and call js code from java .
9+ It provides a safe and convenient way to call Java code from JavaScript and call JavaScript code from Java .
1010
11- ## How JsBridge Work
11+ ## How JsBridge Works
1212![ JsBridge] ( ./JsBridgeWork.png )
1313
1414## Demo
@@ -18,7 +18,7 @@ It provides safe and convenient way to call Java code from js and call js code f
1818
1919## JitPack.io
2020
21- I strongly recommend https://jitpack.io
21+ I strongly recommend [ JitPack.io ] ( https://jitpack.io )
2222
2323``` groovy
2424repositories {
@@ -33,9 +33,9 @@ dependencies {
3333
3434## Use it in Java
3535
36- add com.github.lzyzsd.jsbridge.BridgeWebView to your layout, it is inherited from WebView.
36+ Add ` com.github.lzyzsd.jsbridge.BridgeWebView ` to your layout, it is inherited from WebView.
3737
38- ### Register a Java handler function so that js can call
38+ ### Register a Java handler function so that JavaScript can call
3939
4040``` java
4141
@@ -49,7 +49,7 @@ add com.github.lzyzsd.jsbridge.BridgeWebView to your layout, it is inherited fro
4949
5050```
5151
52- js can call this Java handler method "submitFromWeb" through:
52+ JavaScript can call this Java handler method "submitFromWeb" through:
5353
5454``` javascript
5555
@@ -63,7 +63,7 @@ js can call this Java handler method "submitFromWeb" through:
6363
6464```
6565
66- You can set a default handler in Java, so that js can send message to Java without assigned handlerName
66+ You can set a default handler in Java, so that JavaScript can send messages to Java without an assigned handlerName
6767
6868``` java
6969
@@ -76,7 +76,7 @@ You can set a default handler in Java, so that js can send message to Java witho
7676 window .WebViewJavascriptBridge .doSend (
7777 data
7878 , function (responseData ) {
79- document .getElementById (" show" ).innerHTML = " repsonseData from java, data = " + responseData
79+ document .getElementById (" show" ).innerHTML = " responseData from java, data = " + responseData
8080 }
8181 );
8282
@@ -94,7 +94,7 @@ You can set a default handler in Java, so that js can send message to Java witho
9494
9595```
9696
97- Java can call this js handler function "functionInJs" through:
97+ Java can call this JavaScript handler function "functionInJs" through:
9898
9999``` java
100100
@@ -106,9 +106,9 @@ Java can call this js handler function "functionInJs" through:
106106 });
107107
108108```
109- You can also define a default handler use init method, so that Java can send message to js without assigned handlerName
109+ You can also define a default handler using the init method, so that Java can send messages to JavaScript without an assigned handlerName
110110
111- for example:
111+ For example:
112112
113113``` javascript
114114
@@ -129,7 +129,7 @@ for example:
129129
130130will print 'JS got a message hello' and 'JS responding with' in webview console.
131131
132- ### Switch to CustomWebview
132+ ### Switch to CustomWebView
133133* activity_main.xml
134134``` xml
135135 <com .github.lzyzsd.jsbridge.example.CustomWebView
@@ -139,16 +139,16 @@ will print 'JS got a message hello' and 'JS responding with' in webview console.
139139 </com .github.lzyzsd.jsbridge.example.CustomWebView>
140140```
141141* MainActivity.java
142- Class BridgeWebview change to CustomWebview;
142+ Change BridgeWebView class to CustomWebView:
143143``` java
144144 CustomWebView webView = (CustomWebView ) findViewById(R . id. webView);
145145
146146```
147147
148148## Notice
149149
150- This lib will inject a WebViewJavascriptBridge Object to window object.
151- You can listen to ` WebViewJavascriptBridgeReady ` event to ensure ` window.WebViewJavascriptBridge ` is exist , as the blow code shows:
150+ This library will inject a WebViewJavascriptBridge Object to the window object.
151+ You can listen to the ` WebViewJavascriptBridgeReady ` event to ensure ` window.WebViewJavascriptBridge ` exists , as the below code shows:
152152
153153``` javascript
154154
@@ -196,7 +196,7 @@ setupWebViewJavascriptBridge(function(bridge) {
196196});
197197```
198198
199- It same with https://github.com/marcuswestin/WebViewJavascriptBridge , that would be easier for you to define same behavior in different platform between Android and iOS. Meanwhile, writing concise code.
199+ It's the same as [ WebViewJavascriptBridge ] ( https://github.com/marcuswestin/WebViewJavascriptBridge ) , which makes it easier for you to define the same behavior across different platforms between Android and iOS, while writing concise code.
200200
201201## License
202202
0 commit comments