iOS: fix js exception cause native block
This commit is contained in:
parent
19fc1fdebe
commit
978e33e8c5
@ -86,6 +86,13 @@ - (id)waitUntilResult {
|
||||
self.resultCallback = ^(id r) {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
};
|
||||
void (^originExceptionCallback)(NSException *e) = self.exceptionCallback;
|
||||
self.exceptionCallback = ^(NSException * e) {
|
||||
if(originExceptionCallback){
|
||||
originExceptionCallback(e);
|
||||
}
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
};
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
return self.result;
|
||||
}
|
||||
@ -101,6 +108,13 @@ - (id)waitUntilResult:(id (^)(id result))transformer {
|
||||
ret = transformer(r);
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
};
|
||||
void (^originExceptionCallback)(NSException *e) = self.exceptionCallback;
|
||||
self.exceptionCallback = ^(NSException * e) {
|
||||
if(originExceptionCallback){
|
||||
originExceptionCallback(e);
|
||||
}
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
};
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user