CancelContext

public class CancelContext : Hashable

Keeps track of all promises in a promise chain with pending or currently running tasks, and cancels them all when cancel is called.

  • See

    Hashable

    Declaration

    Swift

    public lazy var hashValue: Int { get set }
  • See

    Hashable

    Declaration

    Swift

    public static func == (lhs: CancelContext, rhs: CancelContext) -> Bool
  • Cancel all members of the promise chain and their associated asynchronous operations.

    Declaration

    Swift

    public func cancel(error: Error? = nil)

    Parameters

    error

    Specifies the cancellation error to use for the cancel operation, defaults to PMKError.cancelled

  • True if all members of the promise chain have been successfully cancelled, false otherwise.

    Declaration

    Swift

    public var isCancelled: Bool { get }
  • True if cancel has been called on the CancelContext associated with this promise, false otherwise. cancelAttempted will be true if cancel is called on any promise in the chain.

    Declaration

    Swift

    public var cancelAttempted: Bool { get }
  • The cancellation error initialized when the promise is cancelled, or nil if not cancelled.

    Declaration

    Swift

    public private(set) var cancelledError: Error? { get set }