mirror of
https://github.com/status-im/react-native-fs.git
synced 2026-08-27 18:11:06 +00:00
completeHandlerIOS now return a promise so you can await for it
This commit is contained in:
+1
-1
@@ -225,7 +225,7 @@ var RNFS = {
|
||||
},
|
||||
|
||||
completeHandlerIOS(jobId: number): void {
|
||||
RNFSManager.completeHandlerIOS(jobId);
|
||||
return RNFSManager.completeHandlerIOS(jobId);
|
||||
},
|
||||
|
||||
readDir(dirpath: string): Promise<ReadDirItem[]> {
|
||||
|
||||
+4
-2
@@ -508,17 +508,19 @@ RCT_EXPORT_METHOD(isResumable:(nonnull NSNumber *)jobId
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(completeHandlerIOS:(nonnull NSNumber *)jobId)
|
||||
RCT_EXPORT_METHOD(completeHandlerIOS:(nonnull NSNumber *)jobId
|
||||
resolver:(RCTPromiseResolveBlock)resolve
|
||||
rejecter:(RCTPromiseRejectBlock)reject)
|
||||
{
|
||||
if (self.uuids) {
|
||||
NSString *uuid = [self.uuids objectForKey:[jobId stringValue]];
|
||||
CompletionHandler completionHandler = [completionHandlers objectForKey:uuid];
|
||||
if (completionHandler) {
|
||||
NSLog(@"Calling completion handler on: %@", uuid);
|
||||
completionHandler();
|
||||
[completionHandlers removeObjectForKey:uuid];
|
||||
}
|
||||
}
|
||||
resolve(nil);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(uploadFiles:(NSDictionary *)options
|
||||
|
||||
Reference in New Issue
Block a user