Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A lightweight javascript bridge to cocoa
Objective-C JavaScript Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Demo
TGJSBridge
.gitignore
LICENSE.md replace SBJson with JSONKit
README.md Update README.md
TGJSBridge.podspec

README.md

THIS PROJECT IS NO LONGER UNDER ACTIVE DEVELOPMENT.

You may consider this project alternativelly, https://github.com/marcuswestin/WebViewJavascriptBridge

TGJSBridge

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

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);

LICENSE

Copyright (c) 2012 Chao Shen(Hangzhou Jiuyan Technology Co., Ltd.). This software is licensed under the BSD License.

Something went wrong with that request. Please try again.