abstract class Promise(Input)
- Promise(Input)
- Reference
- Object
Direct Known Subclasses
Defined in:
promise.crClass Method Summary
- .all(promises)
- .all(*promises)
-
.defer(timeout = nil, &block : -> _)
Execute code in the next tick of the event loop and return a promise for obtaining the value
-
.map(collection : Enumerable(T), &block : T -> V) forall T, V
Asynchronously map an
Enumerable
-
.race(promises)
returns the first promise to either reject or complete
-
.race(*promises)
returns the first promise to either reject or complete
-
.resolve(value)
Returns a resolved promise of the type passed
- .timeout(promise : Promise, time : Time::Span)
Macro Summary
-
collective_action(name, &block)
this drys up the code dealing with splats and enumerables
- new(type, timeout = nil)
- reject(type, reason)
Instance Method Summary
- #catch(&errback : Exception -> _)
- #finally(&callback : Exception | Nil -> _)
- #then : DeferredPromise(Nil)
-
#type : Class
Interfaces available to generic types
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.defer(timeout = nil, &block : -> _)
#
Execute code in the next tick of the event loop and return a promise for obtaining the value
def self.map(collection : Enumerable(T), &block : T -> V) forall T, V
#
Asynchronously map an Enumerable