Add PromiseKit dependency
- Added PromiseKit dependency
This commit is contained in:
14
Carthage/Checkouts/PromiseKit/Sources/after.m
vendored
Normal file
14
Carthage/Checkouts/PromiseKit/Sources/after.m
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#import "AnyPromise.h"
|
||||
@import Dispatch;
|
||||
@import Foundation.NSDate;
|
||||
@import Foundation.NSValue;
|
||||
|
||||
/// @return A promise that fulfills after the specified duration.
|
||||
AnyPromise *PMKAfter(NSTimeInterval duration) {
|
||||
return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve) {
|
||||
dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC));
|
||||
dispatch_after(time, dispatch_get_global_queue(0, 0), ^{
|
||||
resolve(@(duration));
|
||||
});
|
||||
}];
|
||||
}
|
||||
Reference in New Issue
Block a user