forked from marcuswestin/WebViewJavascriptBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify setup and file organization by doing away with the Abstract/…
…iOS/OSX seperation. Instead, we manage the iOS/OSX platform specific part using macros
- Loading branch information
1 parent
baf4a06
commit 57ee322
Showing
17 changed files
with
468 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// WebViewJavascriptBridge.h | ||
// ExampleApp-iOS | ||
// | ||
// Created by Marcus Westin on 6/14/13. | ||
// Copyright (c) 2013 Marcus Westin. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#define kMessageSeparator @"__WVJB_MESSAGE_SEPERATOR__" | ||
#define kCustomProtocolScheme @"wvjbscheme" | ||
#define kQueueHasMessage @"__WVJB_QUEUE_MESSAGE__" | ||
|
||
#if TARGET_OS_IPHONE && defined(__IPHONE_5_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0) | ||
#define WVJB_WEAK_FALLBACK weak | ||
#elif TARGET_OS_MAC && defined(__MAC_10_7) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7) | ||
#define WVJB_WEAK_FALLBACK weak | ||
#else | ||
#define WVJB_WEAK_FALLBACK unsafe_unretained | ||
#endif | ||
|
||
#if defined __MAC_OS_X_VERSION_MAX_ALLOWED | ||
#import <WebKit/WebKit.h> | ||
#define WVJB_PLATFORM_OSX | ||
#define WVJB_WEBVIEW_TYPE WebView | ||
#define WVJB_WEBVIEW_DELEGATE_TYPE NSObject | ||
#elif defined __IPHONE_OS_VERSION_MAX_ALLOWED | ||
#define WVJB_PLATFORM_IOS | ||
#define WVJB_WEBVIEW_TYPE UIWebView | ||
#define WVJB_WEBVIEW_DELEGATE_TYPE NSObject<UIWebViewDelegate> | ||
#endif | ||
|
||
typedef void (^WVJBResponseCallback)(id responseData); | ||
typedef void (^WVJBHandler)(id data, WVJBResponseCallback responseCallback); | ||
|
||
@interface WebViewJavascriptBridge : WVJB_WEBVIEW_DELEGATE_TYPE | ||
|
||
+ (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView handler:(WVJBHandler)handler; | ||
+ (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WVJB_WEBVIEW_DELEGATE_TYPE*)webViewDelegate handler:(WVJBHandler)handler; | ||
+ (void)enableLogging; | ||
|
||
- (void)send:(id)message; | ||
- (void)send:(id)message responseCallback:(WVJBResponseCallback)responseCallback; | ||
- (void)registerHandler:(NSString*)handlerName handler:(WVJBHandler)handler; | ||
- (void)callHandler:(NSString*)handlerName; | ||
- (void)callHandler:(NSString*)handlerName data:(id)data; | ||
- (void)callHandler:(NSString*)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback; | ||
- (void)reset; | ||
|
||
@end |
File renamed without changes.
Oops, something went wrong.