Nenhuma Descrição

WebViewJavascriptBridge.h 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // WebViewJavascriptBridge.h
  3. // ExampleApp-iOS
  4. //
  5. // Created by Marcus Westin on 6/14/13.
  6. // Copyright (c) 2013 Marcus Westin. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "WebViewJavascriptBridgeBase.h"
  10. #if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_1)
  11. #define supportsWKWebView
  12. #endif
  13. #if defined supportsWKWebView
  14. #import <WebKit/WebKit.h>
  15. #endif
  16. #if defined __MAC_OS_X_VERSION_MAX_ALLOWED
  17. #define WVJB_PLATFORM_OSX
  18. #define WVJB_WEBVIEW_TYPE WebView
  19. #define WVJB_WEBVIEW_DELEGATE_TYPE NSObject<WebViewJavascriptBridgeBaseDelegate>
  20. #define WVJB_WEBVIEW_DELEGATE_INTERFACE NSObject<WebViewJavascriptBridgeBaseDelegate, WebPolicyDelegate>
  21. #elif defined __IPHONE_OS_VERSION_MAX_ALLOWED
  22. #import <UIKit/UIWebView.h>
  23. #define WVJB_PLATFORM_IOS
  24. #define WVJB_WEBVIEW_TYPE UIWebView
  25. #define WVJB_WEBVIEW_DELEGATE_TYPE NSObject<UIWebViewDelegate>
  26. #define WVJB_WEBVIEW_DELEGATE_INTERFACE NSObject<UIWebViewDelegate, WebViewJavascriptBridgeBaseDelegate>
  27. #endif
  28. @interface WebViewJavascriptBridge : WVJB_WEBVIEW_DELEGATE_INTERFACE
  29. + (instancetype)bridgeForWebView:(id)webView;
  30. + (instancetype)bridge:(id)webView;
  31. + (void)enableLogging;
  32. + (void)setLogMaxLength:(int)length;
  33. - (void)registerHandler:(NSString*)handlerName handler:(WVJBHandler)handler;
  34. - (void)removeHandler:(NSString*)handlerName;
  35. - (void)callHandler:(NSString*)handlerName;
  36. - (void)callHandler:(NSString*)handlerName data:(id)data;
  37. - (void)callHandler:(NSString*)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback;
  38. - (void)setWebViewDelegate:(id)webViewDelegate;
  39. - (void)disableJavscriptAlertBoxSafetyTimeout;
  40. @end