BSD license


The BSD license is an
open-source license.
Free Read License

14 Day money-back guarantee

Full refund within 14 days of purchase date.

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.

(3 ratings)

Javascript to Cocoa bridge for iOS

Javascript to Cocoa bridge for iOS
Developed by ChaoShen, Released Jul 5, 2012

A lightweight javascript bridge to cocoa

Objective-C

Tags: bridge , javascript , native , phonegap

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);
View all 1 reviews »

User Reviews

  • 1 of 1 people found this review helpful M Profiet 11 months ago
    Very nice, it helps that it is FREE :)
    Flag
    Was this helpful? Yes No
Read all 4 comments »

Questions & Comments


Or enter your name and Email
You must be logged-in to vote. Log-in to your account or register now.