Promise
public class Promise<T>
A lightweight promise implementation for asynchronous operations.
Used by SDK methods like endChat(), setLanguage(), and kill() which return Promise<Void>.
Chain results with .then { } and handle errors with .catch { }.
-
Undocumented
Declaration
Swift
public typealias onFulfilled = (T) throws -> Void -
Undocumented
Declaration
Swift
public typealias onRejected = (Error) -> Void -
Creates an immediately resolved promise with the given value
Declaration
Swift
public static func resolve(_ value: T) -> Promise<T> -
Creates an immediately rejected promise with the given error
Declaration
Swift
public static func reject(_ error: Error) -> Promise<T> -
Undocumented
Declaration
Swift
func fulfill(_ value: T) -
Undocumented
Declaration
Swift
func reject(_ error: Error) -
Undocumented
Declaration
Swift
@discardableResult func then(on queue: DispatchQueue = .promises, _ onFulfilled: @escaping onFulfilled) -> Promise<T> -
Undocumented
Declaration
Swift
@discardableResult func `catch`(on queue: DispatchQueue = .promises, _ onRejected: @escaping onRejected) -> Promise<T> -
Undocumented
Declaration
Swift
@discardableResult func always(on queue: DispatchQueue = .promises, _ block: @escaping () -> Void) -> Promise<T> -
Undocumented
Declaration
Swift
func pipe(to target: Promise<T>)
View on GitHub