PDRCoreAppFrame.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // PDR_Manager_Feature.h
  3. // Pandora
  4. //
  5. // Created by Mac Pro_C on 12-12-25.
  6. // Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import "PDRCore.h"
  11. #import "PDRNView.h"
  12. @class PDRCoreAppFrame;
  13. @class PDRCoreApp;
  14. @class PDRCoreAppWindow;
  15. @class PGMethod;
  16. @class PDRCoreAppFrameFeature;
  17. @class H5WEWebEngine;
  18. NS_ASSUME_NONNULL_BEGIN
  19. ///页面加载完成通知
  20. extern NSString *const PDRCoreAppFrameDidLoadNotificationKey;
  21. ///页面关闭通知
  22. extern NSString *const PDRCoreAppFrameDidCloseNotificationKey;
  23. ///页面将要加载通知
  24. extern NSString *const PDRCoreAppFrameWillLoadNotificationKey;
  25. ///页面开始加载通知
  26. extern NSString *const PDRCoreAppFrameStartLoadNotificationKey;
  27. ///页面加载失败通知
  28. extern NSString *const PDRCoreAppFrameLoadFailedNotificationKey;
  29. ///页面标题变化通知
  30. extern NSString *const PDRCoreAppFrameTitleUpdaedNotificationKey;
  31. /// H5+应用页面
  32. @interface PDRCoreAppFrame : PDRNView
  33. /// 创建runtime页面(使用 WKWebview 渲染)
  34. /// @param aFrameID 页面标识
  35. /// @param pagePath 页面地址 支持http:// file:// 本地地址
  36. /// @param basePath 加载本地页面时指定页面可访问资源路径(通常设置为页面所在目录以 file:// 开头)
  37. /// @param frame 页面位置
  38. - (PDRCoreAppFrame*)initWithName:(NSString *)aFrameID
  39. loadURL:(NSString *)pagePath
  40. baseURL:(NSString *)basePath
  41. frame:(CGRect)frame;
  42. /// 已废弃,请使用 -initWithName:loadURL:baseURL:frame:
  43. /// @param aFrameID 页面标识
  44. /// @param pagePath 页面地址 支持http:// file:// 本地地址
  45. /// @param frame 页面位置
  46. /// @param engineName 渲染引擎,可选值 UIWebview 或 WKWebview (UIWebview即将废弃,不建议使用,上面的方法默认使用 WKWebview 渲染页面)
  47. - (PDRCoreAppFrame*)initWithName:(NSString*)aFrameID
  48. loadURL:(NSString*)pagePath
  49. frame:(CGRect)frame
  50. withEngineName:(NSString*__nullable)engineName __attribute__((deprecated("deprecated, Use -initWithName:loadURL:baseURL:frame:")));
  51. /// 已废弃,请使用 -initWithName:loadURL:baseURL:frame:
  52. - (PDRCoreAppFrame*)initWithName:(NSString*)viewName
  53. loadURL:(NSString*)pagePath
  54. frame:(CGRect)frame __attribute__((deprecated("deprecated, Use -initWithName:loadURL:baseURL:frame:")));
  55. /// 页面名字用作plus.webview.findViewById()中的id
  56. //@property(nonatomic, copy)NSString *frameName; @see//@property(nonatomic, copy)NSString *viewName;
  57. /// HTML CSS渲染View
  58. @property(nonatomic, readonly, nullable)H5WEWebEngine *webEngine;
  59. /// 页面地址
  60. @property(nonatomic, copy, nullable)NSString* currenLocationHref;
  61. @property(nonatomic, copy, nullable)NSString* baseURL;
  62. /**
  63. @brief 在当前页面同步执行Javascript
  64. @param js javasrcipt 脚本
  65. @return NSString* 执行结果
  66. */
  67. - (NSString*)stringByEvaluatingJavaScriptFromString:(NSString*)js;
  68. - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^__nullable)(id, NSError* ))completionHandler;
  69. /// @brief 关闭页面中的键盘
  70. - (void)dismissKeyboard;
  71. /// @brief 触发document事件 document.addEventListener(evtName,function(e){})
  72. - (void)dispatchDocumentEvent:(NSString*)evtName;
  73. - (void)dispatchForgroundEvent:(NSString*)actType;
  74. - (void)dispatchDocumentEvent:(NSString *)evtName withData:(NSDictionary*__nullable)data;
  75. @end
  76. NS_ASSUME_NONNULL_END