File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 22一个优雅的hybrid方案:native,JS端两端实现
33
44
5- ** CSWebViewJavascriptBridge是一套hybrid方案,包括iOS端与Web端的实现,可以为任意webView提供hybrid能力,也可以直接使用webBrowViewController提供的hybrid能力。JS端的依赖脚本提前注入到native的webview中 ,业务JS中可直接根据业务员模块进行调用,扩充。**
5+ ** CSWebViewJavascriptBridge是一套hybrid方案,包括iOS端与Web端的实现,可以为任意webView提供hybrid能力,也可以直接使用webBrowViewController提供的hybrid能力。JS端的依赖脚本提前注入到native的webView中 ,业务JS中可直接根据业务员模块进行调用,扩充。**
66
77
88整体框架如图:
99
10101.Bridge:
1111
12+ ![ Alt text] ( https://github.com/dormitory219/CSWebViewJavascriptBridge/blob/master/Readme/CSJSBridge.png )
13+
12142.Handler,Action:
1315
16+ ![ Alt text] ( https://github.com/dormitory219/CSWebViewJavascriptBridge/blob/master/Readme/CSJSHandlers.png )
17+
14183.JS
1519
20+ ![ Alt text] ( https://github.com/dormitory219/CSWebViewJavascriptBridge/blob/master/Readme/web.png )
1621
1722
1823### 说点其他的,hybrid能力分两大类
2530比如:CSUIWebViewJavascriptBridge提供UIWebview的hybrid交互,CSWKWebViewJavascriptBridge提供WKWebview的hybrid的交互。
2631
2732下面来分别讲述本方案中native调用JS,JS调用native的流程及技术实现:
28- ##本方案技术实现
33+
34+ ## 本方案技术实现:
2935
3036### 1. JS调用native:
3137
@@ -164,7 +170,7 @@ CSJSCommonHandler.prototype.getDeviceInfo = function(callback){
164170
165171```
166172
167- 如上getLocationInfo调用 :
173+ 如上getDeviceInfo调用 :
168174
169175```
170176jsCommonHandler.getDeviceInfo((data) => {
@@ -430,3 +436,7 @@ CSJSBridgeCore.prototype.callbackWeb = function(data){
430436```
431437
432438
439+ ### 2. native调用JS:
440+ 待填坑。。。。
441+
442+
You can’t perform that action at this time.
0 commit comments