BURexxarEngine.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // BURexxarEngine.h
  3. // BURexxar
  4. //
  5. // Created by muhuai on 2017/4/26.
  6. // Copyright © 2017年 muhuai. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import "BUStaticPlugin.h"
  11. @protocol BUJSBAuthorization;
  12. @protocol BURexxarEngine <NSObject>
  13. @required
  14. /**
  15. engine所在的ViewController, 提供JSBridge更多的上下文. 可为空.
  16. */
  17. @property (nonatomic, weak) UIViewController *ttr_sourceController;
  18. /**
  19. engine所挂载的静态plugin集合
  20. */
  21. @property (nonatomic, strong) BUStaticPlugin *ttr_staticPlugin;
  22. /**
  23. engine当前页面地址
  24. */
  25. @property (nonatomic, strong, readonly) NSURL *ttr_url;
  26. @optional
  27. /**
  28. JSBridge授权器, 每个业务方可自行注入. 默认为nil, 全部public权限
  29. */
  30. @property (nonatomic, strong) id<BUJSBAuthorization> ttr_authorization;
  31. #pragma mark - Executing JavaScript
  32. @required
  33. /**
  34. 注入JavaScrip
  35. @param script 需要注入的script
  36. @param completion 完成的回调
  37. */
  38. - (void)ttr_evaluateJavaScript:(NSString *)script completionHandler:(void (^)(id result, NSError *error))completion;
  39. /**
  40. 对容器内发送通知
  41. @param event 通知名称
  42. @param data 携带的信息
  43. */
  44. - (void)ttr_fireEvent:(NSString *)event data:(NSDictionary *)data;
  45. @end