Javascript to Cocoa bridge for iOS

A lightweight javascript bridge to cocoa

TGJSBridge is a lightweight javascript bridge to cocoa. TGJSBridge is iOS4 and iPad compatible.

Github

https://github.com/ohsc/TGJSBridge

Usage in objective-c

Init jsBridge

TGJSBridge *jsBridge = [TGJSBridge jsBridgeWithDelegate: webViewDelegate];
webView.delegate = jsBridge;

Send notification to javascript

postNotificationName:userInfo:toWebView:

Listen notification from javascript

- (void)jsBridge:(TGJSBridge *)bridge didReceivedNotificationName:(NSString *)name userInfo:(NSDictionary *)userInfo fromWebView:(UIWebView *)webview

Usage in webview

Send notification to cocoa

jsBridge.postNotification(msgName,userInfo);

Listen notification from cocoa

jsBridge.bind(msgName, function(userInfo){
    ...
});

Cancel listening notification from cocoa

jsBridge.unbind('test',callbackHandler);
You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

License » BSD license Download
or Get a quote

for customization or integration services

  • Very nice, it helps that it is FREE :)
    MP M Profiet
    2 years ago, 0 comments
    Was this helpful?
    Flag 1 of 1 people found this review helpful
Post a comment

Or enter your name and Email