commit | author | age
|
a6c014
|
1 |
/** |
L |
2 |
Copyright 2018 Google Inc. All rights reserved. |
|
3 |
|
|
4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
you may not use this file except in compliance with the License. |
|
6 |
You may obtain a copy of the License at: |
|
7 |
|
|
8 |
http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
|
|
10 |
Unless required by applicable law or agreed to in writing, software |
|
11 |
distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
See the License for the specific language governing permissions and |
|
14 |
limitations under the License. |
|
15 |
*/ |
|
16 |
|
|
17 |
#import "FBLPromise.h" |
|
18 |
|
|
19 |
NS_ASSUME_NONNULL_BEGIN |
|
20 |
|
|
21 |
@interface FBLPromise<Value>(AllAdditions) |
|
22 |
|
|
23 |
/** |
|
24 |
Wait until all of the given promises are fulfilled. |
|
25 |
If one of the given promises is rejected, then the returned promise is rejected with same error. |
|
26 |
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, |
|
27 |
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. |
|
28 |
Promises resolved with `nil` become `NSNull` instances in the resulting array. |
|
29 |
|
|
30 |
@param promises Promises to wait for. |
|
31 |
@return Promise of an array containing the values of input promises in the same order. |
|
32 |
*/ |
|
33 |
+ (FBLPromise<NSArray *> *)all:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); |
|
34 |
|
|
35 |
/** |
|
36 |
Wait until all of the given promises are fulfilled. |
|
37 |
If one of the given promises is rejected, then the returned promise is rejected with same error. |
|
38 |
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, |
|
39 |
it's implicitly considered a pre-fulfilled or pre-rejected FBLPromise correspondingly. |
|
40 |
Promises resolved with `nil` become `NSNull` instances in the resulting array. |
|
41 |
|
|
42 |
@param queue A queue to dispatch on. |
|
43 |
@param promises Promises to wait for. |
|
44 |
@return Promise of an array containing the values of input promises in the same order. |
|
45 |
*/ |
|
46 |
+ (FBLPromise<NSArray *> *)onQueue:(dispatch_queue_t)queue |
|
47 |
all:(NSArray *)promises NS_REFINED_FOR_SWIFT; |
|
48 |
|
|
49 |
@end |
|
50 |
|
|
51 |
/** |
|
52 |
Convenience dot-syntax wrappers for `FBLPromise` `all` operators. |
|
53 |
Usage: FBLPromise.all(@[ ... ]) |
|
54 |
*/ |
|
55 |
@interface FBLPromise<Value>(DotSyntax_AllAdditions) |
|
56 |
|
|
57 |
+ (FBLPromise<NSArray *> * (^)(NSArray *))all FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); |
|
58 |
+ (FBLPromise<NSArray *> * (^)(dispatch_queue_t, NSArray *))allOn FBL_PROMISES_DOT_SYNTAX |
|
59 |
NS_SWIFT_UNAVAILABLE(""); |
|
60 |
|
|
61 |
@end |
|
62 |
|
|
63 |
NS_ASSUME_NONNULL_END |