abstract class Promise(Input)

Direct Known Subclasses

Defined in:

promise.cr

Class Method Summary

Macro Summary

Instance Method Summary

Instance methods inherited from class Object

__check_for_promise__ __check_for_promise__

Macros inherited from class Object

__check_if_promise__ __check_if_promise__

Class Method Detail

def self.all(promises) #

[View source]
def self.all(*promises) #

[View source]
def self.defer(timeout = nil, &block : -> _) #

Execute code in the next tick of the event loop and return a promise for obtaining the value


[View source]
def self.map(collection : Enumerable(T), &block : T -> V) forall T, V #

Asynchronously map an Enumerable


[View source]
def self.race(promises) #

returns the first promise to either reject or complete


[View source]
def self.race(*promises) #

returns the first promise to either reject or complete


[View source]
def self.resolve(value) #

Returns a resolved promise of the type passed


[View source]
def self.timeout(promise : Promise, time : Time::Span) #

[View source]

Macro Detail

macro collective_action(name, &block) #

this drys up the code dealing with splats and enumerables


[View source]
macro new(type, timeout = nil) #

[View source]
macro reject(type, reason) #

[View source]

Instance Method Detail

def catch(&errback : Exception -> _) #

[View source]
def finally(&callback : Exception | Nil -> _) #

[View source]
abstract def then : DeferredPromise(Nil) #

[View source]
abstract def type : Class #

Interfaces available to generic types


[View source]