CancellablePromise
public class CancellablePromise<T> : CancellableThenable, CancellableCatchMixin
extension CancellablePromise: _PMKSharedWrappers
extension CancellablePromise: _PMKCatchWrappers
extension CancellablePromise: _PMKSharedVoidWrappers where C.T == Void
A CancellablePromise is a functional abstraction around a failable and cancellable asynchronous operation.
At runtime the promise can become a member of a chain of promises, where the cancelContext is used to track and cancel (if desired) all promises in this chain.
-
Delegate
thenablefor this CancellablePromiseDeclaration
Swift
public var thenable: U { get } -
Delegate
catchablefor this CancellablePromiseDeclaration
Swift
public var catchable: C { get } -
The CancelContext associated with this CancellablePromise
Declaration
Swift
public var cancelContext: CancelContext -
Tracks the cancel items for this CancellablePromise. These items are removed from the associated CancelContext when the promise resolves.
Declaration
Swift
public var cancelItemList: CancelItemList -
Initialize a new rejected cancellable promise.
Declaration
Swift
public convenience init(cancellable: Cancellable? = nil, error: Error) -
Initialize a new cancellable promise that can be resolved with the provided
Resolver.Declaration
Swift
public convenience init(cancellable: Cancellable? = nil, resolver body: (Resolver<T>) throws -> Void) -
Initialize a new cancellable promise using the given Promise and its Resolver.
Declaration
Swift
public convenience init(cancellable: Cancellable? = nil, promise: Promise<T>, resolver: Resolver<T>) -
See
Thenable.resultDeclaration
Swift
public var result: Result<T, Error>? { get }Return Value
The current
Resultfor this cancellable promise. -
Blocks this thread, so—you know—don’t call this on a serial thread that any part of your chain may use. Like the main thread for example.
Declaration
Swift
public func wait() throws -> T -
Undocumented
Declaration
Swift
public typealias T = T -
Undocumented
Declaration
Swift
public typealias BaseOfT = CancellablePromise<T>
-
Initializes a new cancellable promise fulfilled with
VoidDeclaration
Swift
public convenience init() -
Initializes a new cancellable promise fulfilled with
Voidand with the givenCancellableDeclaration
Swift
public convenience init(cancellable: Cancellable)
View on GitHub
CancellablePromise Class Reference