iOS Bridge part

This commit is contained in:
pengfei.zhou
2019-07-30 11:25:05 +08:00
parent c1e4ccd984
commit 6e6dc4edef
8 changed files with 91 additions and 9 deletions

View File

@@ -47,12 +47,17 @@ + (instancetype)instance{
- (DoricAsyncResult<JSValue *> *)invokeDoricMethod:(NSString *)method arguments:(va_list)args {
DoricAsyncResult *ret = [[DoricAsyncResult alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];
id arg;
while((arg = va_arg(args, id)) != nil){
[array addObject:arg];
}
__weak typeof(self) _self = self;
dispatch_async(self.jsExecutor.jsQueue, ^(){
__strong typeof(_self) self = _self;
if (!self) return;
@try {
JSValue *jsValue = [self.jsExecutor invokeDoricMethod:method arguments:args];
JSValue *jsValue = [self.jsExecutor invokeDoricMethod:method argumentsArray:array];
[ret setupResult:jsValue];
} @catch (NSException *exception) {
[ret setupError:exception];