add custom event
parent
2a14420554
commit
02c2e68c1c
4
Podfile
4
Podfile
|
@ -4,8 +4,8 @@ platform :ios, "9.0"
|
|||
inhibit_all_warnings!
|
||||
|
||||
target "demo" do
|
||||
pod 'FinApplet', '2.28.1'
|
||||
pod 'FinAppletExt', '2.28.1'
|
||||
pod 'FinApplet', '2.29.1'
|
||||
pod 'FinAppletExt', '2.29.1'
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -59,9 +59,22 @@
|
|||
@"path" : @"/pages/webview/webview"
|
||||
};
|
||||
[self.appletList addObject:@{@"appId":@"5fc8934aefb8c600019e9747",@"title":@"自定义H5 API示例", @"startParams":startParams}];
|
||||
[self.appletList addObject:@{@"appId":@"60c5bbf99e094f00015079ee",@"title":@"原生向小程序发送事件"}];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)sendCustomEvent
|
||||
{
|
||||
if (@available(iOS 10.0, *)) {
|
||||
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:3 repeats:YES block:^(NSTimer * _Nonnull timer) {
|
||||
NSTimeInterval timestamp = [[NSDate date] timeIntervalSince1970];
|
||||
[[FATClient sharedClient].nativeViewManager sendCustomEventWithDetail:@{@"timestamp":@(timestamp)} completion:^(id result, NSError *error) {
|
||||
NSLog(@"sendCustomEventW:%@", error);
|
||||
}];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
|
@ -91,7 +104,9 @@
|
|||
NSDictionary *startParams = dict[@"startParams"];
|
||||
|
||||
[[FATClient sharedClient] startRemoteApplet:appId startParams:startParams InParentViewController:self completion:^(BOOL result, NSError *error) {
|
||||
|
||||
if ([appId isEqualToString:@"60c5bbf99e094f00015079ee"]) {
|
||||
[self sendCustomEvent];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue