1.新建OC类XXXEventModule.h
#import <WeexSDK/WXEventModuleProtocol.h>
#import <WeexSDK/WXModuleProtocol.h>
@interface AQXEventModule : NSObject <WXEventModuleProtocol, WXModuleProtocol>
@end
2.XXXEventModule.m
#import "XXXEventModule.h"
@implementation XXXEventModule
@synthesize weexInstance;
WX_EXPORT_METHOD(@selector(weexSay:))
- (void)weexSay:(NSString *)string
{
NSLog(@"weexSay:%@",string);
}
@end
3.初始化的时候注册XXXEventModule
[WXSDKEngine registerModule:@"event" withClass:[XXXEventModule class]];//event注册的关键字
4.在weex调用
this.$call("event", "weexSay", "Hello, Weex!");//event注册的关键字