Skip to content

Commit

Permalink
Merge pull request alibaba#82 from ZoMinster/event_opt
Browse files Browse the repository at this point in the history
Event opt
  • Loading branch information
SoXeon authored Aug 2, 2017
2 parents 0552d4d + 7328a18 commit 06ea96b
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 108 deletions.
5 changes: 4 additions & 1 deletion BeeHive/BHContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef enum
}BHEnvironmentType;


@interface BHContext : NSObject
@interface BHContext : NSObject <NSCopying>

//global env
@property(nonatomic, assign) BHEnvironmentType env;
Expand Down Expand Up @@ -55,6 +55,9 @@ typedef enum
//user Activity Model
@property (nonatomic, strong) BHUserActivityItem *userActivityItem;

//custom param
@property (nonatomic, copy) NSDictionary *customParam;

+ (instancetype)shareInstance;

- (void)addServiceWithImplInstance:(id)implInstance serviceName:(NSString *)serviceName;
Expand Down
22 changes: 22 additions & 0 deletions BeeHive/BHContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,26 @@ - (instancetype)init
return self;
}

- (instancetype)copyWithZone:(NSZone *)zone {
BHContext *context = [[self.class allocWithZone:zone] init];

context.env = self.env;
context.config = self.config;
context.appkey = self.appkey;
context.customEvent = self.customEvent;
context.application = self.application;
context.launchOptions = self.launchOptions;
context.moduleConfigName = self.moduleConfigName;
context.serviceConfigName = self.serviceConfigName;
#if __IPHONE_OS_VERSION_MAX_ALLOWED > 80400
context.touchShortcutItem = self.touchShortcutItem;
#endif
context.openURLItem = self.openURLItem;
context.notificationsItem = self.notificationsItem;
context.userActivityItem = self.userActivityItem;
context.customParam = self.customParam;

return context;
}

@end
14 changes: 13 additions & 1 deletion BeeHive/BHModuleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,23 @@ typedef NS_ENUM(NSInteger, BHModuleEventType)
// If you do not comply with set Level protocol, the default Normal
- (void)registerDynamicModule:(Class)moduleClass;

- (void)registerDynamicModule:(Class)moduleClass
shouldTriggerInitEvent:(BOOL)shouldTriggerInitEvent;

- (void)loadLocalModules;

- (void)registedAllModules;

- (void)triggerEvent:(BHModuleEventType)eventType;
- (void)registerCustomEvent:(NSInteger)eventType
withModuleInstance:(id)moduleInstance
andSelectorStr:(NSString *)selectorStr;

- (void)triggerEvent:(NSInteger)eventType;

- (void)triggerEvent:(NSInteger)eventType
withCustomParam:(NSDictionary *)customParam;



@end

Loading

0 comments on commit 06ea96b

Please sign in to comment.