Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (13 sloc) 1.17 KB
intended v2.0.0
+ Messages are objects instead of strings. Supports NSDictionary*/Objects, NSArray*/Arrays, NSNumber*/Number & NSString*/String.
+ Messages are encoded with NSJSONSerialization. Optional fallback to JSONKit for iOS 4 support.
+ Messages can expect responses. A message received with an expected response is accompanied by a WVJBResponse* object.
+ Handlers can be registered by name, and called with data and an optional expected response.
+ Responses expect either an error or data (`-(void)respond:(id)data`, -(void)respondWithError:(id)error)
v0.0.1
+ ObjC: A WebViewJavascriptBridge class (a UIWebViewDelegate) that enables message passing to and from the JS
+ ObjC: A protocol called WebViewJavascriptBridgeDelegate that lets you handle messages received from the JS
+ JS: Event when the bridge is ready - document.addEventListener('WebViewJavascriptBridgeReady', function() {}, false)
+ JS: Ability to set your message handler - WebViewJavascriptBridge.setMessageHandler(function() {})
+ JS: Function to send messages - WebViewJavascriptBridge.sendMessage('a message');
+ All messages are strings. Use JSON in your js and e.g. JSONKit in iOS to send structured messages