Skip to content

Commit e8171e8

Browse files
committed
Merge pull request marcuswestin#76 from burczyk/feature/custombundle
Updated Readme with custom bundle example
2 parents c56fdb6 + 4c34caa commit e8171e8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ Example:
144144
NSLog(@"Current UIWebView page URL is: %@", responseData);
145145
}];
146146

147+
#### Custom bundle
148+
`WebViewJavascriptBridge` requires `WebViewJavascriptBridge.js.txt` file that is injected into web view to create a bridge on JS side. Standard implementation uses `mainBundle` to search for this file. If you e.g. build a static library and you have that file placed somewhere else you can use this method to specify which bundle should be searched for `WebViewJavascriptBridge.js.txt` file:
149+
150+
##### `[WebViewJavascriptBridge bridgeForWebView:(UIWebView/WebView*)webView webViewDelegate:(UIWebViewDelegate*)webViewDelegate handler:(WVJBHandler)handler resourceBundle:(NSBundle*)bundle`
151+
152+
Example:
153+
154+
155+
```
156+
[WebViewJavascriptBridge bridgeForWebView:_webView
157+
webViewDelegate:self
158+
handler:^(id data, WVJBResponseCallback responseCallback) {
159+
NSLog(@"Received message from javascript: %@", data);
160+
}
161+
resourceBundle:[NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"ResourcesBundle" withExtension:@"bundle"]]
162+
];
163+
```
147164

148165
### Javascript API
149166

0 commit comments

Comments
 (0)