Skip to content

Commit fdadbbe

Browse files
committed
update RM
1 parent 52d4378 commit fdadbbe

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
# JsBridge-WebViewJavascriptBridge
22
iOS JsBridge Solution by WebViewJavascriptBridge
33

4+
[JsBridge](https://github.com/pengwei1024/JsBridge) 开发的 iOS 解决方案
5+
46
![](./screenshot.gif)
57

8+
## Sample
9+
**Native register**
10+
11+
```
12+
[self.bridge registerHandler:@"MyBridge.native.alertDialog" handler:^(id data, WVJBResponseCallback responseCallback) {
13+
14+
if (data && [data isKindOfClass:[NSDictionary class]]) {
15+
NSLog(@"title = %@, desc=%@", [data objectForKey:@"title"], [data objectForKey:@"desc"]);
16+
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[data objectForKey:@"title"]
17+
message:[data objectForKey:@"desc"]
18+
delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"sure", nil];
19+
[alertView show];
20+
callback = responseCallback;
21+
}
22+
}];
23+
```
24+
**Js Call**
25+
26+
```
27+
MyBridge.native.alertDialog(
28+
'Title',
29+
'it\'s a native dialog',
30+
function(){
31+
alert('sure button click');
32+
},
33+
function(){
34+
alert('cancel button click');
35+
}
36+
);
37+
```
38+
39+
## License
40+
<pre>
41+
Licensed under the Apache License, Version 2.0 (the "License");
42+
you may not use this file except in compliance with the License.
43+
You may obtain a copy of the License at
44+
45+
http://www.apache.org/licenses/LICENSE-2.0
46+
47+
Unless required by applicable law or agreed to in writing, software
48+
distributed under the License is distributed on an "AS IS" BASIS,
49+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50+
See the License for the specific language governing permissions and
51+
limitations under the License.
52+
</pre>
53+

0 commit comments

Comments
 (0)