class Promise::DeferredPromise(Input)

Direct Known Subclasses

Defined in:

promise/deferred_promise.cr

Constructors

Instance Method Summary

Instance methods inherited from class Promise(Input)

catch(&errback : Exception -> _) catch, finally(&callback : Exception | Nil -> _) finally, then : DeferredPromise(Nil) then, type : Class type

Class methods inherited from class Promise(Input)

all(promises)
all(*promises)
all
, defer(timeout = nil, &block : -> _) defer, map(collection : Enumerable(T), &block : T -> V) forall T, V map, race(promises)
race(*promises)
race
, resolve(value) resolve, timeout(promise : Promise, time : Time::Span) timeout

Macros inherited from class Promise(Input)

collective_action(name, &block) collective_action, new(type, timeout = nil) new, reject(type, reason) reject

Instance methods inherited from class Object

__check_for_promise__ __check_for_promise__

Macros inherited from class Object

__check_if_promise__ __check_if_promise__

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def catch(&errback : Exception -> Exception | Input | DeferredPromise(Input) | RejectedPromise(Input) | ResolvedPromise(Input)) #

Callback to execute if an error occurs


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

[View source]
def get : Input #

pause the current fiber and wait for the resolution to occur


[View source]
def raw_value #

[View source]
def reject(reason) #

[View source]
def resolve(value) #

[View source]
def resolved? #

Has the promise value been resolved?


[View source]
def then(callback : Input -> _, errback : Exception -> _) #

[View source]
def then(&callback : Input -> _) #

Callback to be executed once the value is available


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

Used to create a generic promise if all we care about is success or failure


[View source]
def type : Class #
Description copied from class Promise(Input)

Interfaces available to generic types


[View source]
def type_var #

A cool hack to grab the promise type


[View source]