1 |
efrain |
1 |
/**
|
|
|
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 |
/**
|
|
|
22 |
Waits for all scheduled promises blocks.
|
|
|
23 |
|
|
|
24 |
@param timeout Maximum time to wait.
|
|
|
25 |
@return YES if all promises blocks have completed before the timeout and NO otherwise.
|
|
|
26 |
*/
|
|
|
27 |
FOUNDATION_EXTERN BOOL FBLWaitForPromisesWithTimeout(NSTimeInterval timeout) NS_REFINED_FOR_SWIFT;
|
|
|
28 |
|
|
|
29 |
@interface FBLPromise<Value>(TestingAdditions)
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
Dispatch group for promises that is typically used to wait for all scheduled blocks.
|
|
|
33 |
*/
|
|
|
34 |
@property(class, nonatomic, readonly) dispatch_group_t dispatchGroup NS_REFINED_FOR_SWIFT;
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
Properties to get the current state of the promise.
|
|
|
38 |
*/
|
|
|
39 |
@property(nonatomic, readonly) BOOL isPending NS_REFINED_FOR_SWIFT;
|
|
|
40 |
@property(nonatomic, readonly) BOOL isFulfilled NS_REFINED_FOR_SWIFT;
|
|
|
41 |
@property(nonatomic, readonly) BOOL isRejected NS_REFINED_FOR_SWIFT;
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
Value the promise was fulfilled with.
|
|
|
45 |
Can be nil if the promise is still pending, was resolved with nil or after it has been rejected.
|
|
|
46 |
*/
|
|
|
47 |
@property(nonatomic, readonly, nullable) Value value NS_REFINED_FOR_SWIFT;
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
Error the promise was rejected with.
|
|
|
51 |
Can be nil if the promise is still pending or after it has been fulfilled.
|
|
|
52 |
*/
|
|
|
53 |
@property(nonatomic, readonly, nullable) NSError *error NS_REFINED_FOR_SWIFT;
|
|
|
54 |
|
|
|
55 |
@end
|
|
|
56 |
|
|
|
57 |
NS_ASSUME_NONNULL_END
|