class Promise::DeferredPromise(Input)
Direct Known Subclasses
Defined in:
promise/deferred_promise.crConstructors
Instance Method Summary
-
#catch(&errback : Exception -> Exception | Input | DeferredPromise(Input) | RejectedPromise(Input) | ResolvedPromise(Input))
Callback to execute if an error occurs
- #finally(&callback : Exception | Nil -> _)
-
#get : Input
pause the current fiber and wait for the resolution to occur
- #raw_value
- #reject(reason)
- #resolve(value)
-
#resolved?
Has the promise value been resolved?
- #then(callback : Input -> _, errback : Exception -> _)
-
#then(&callback : Input -> _)
Callback to be executed once the value is available
-
#then : DeferredPromise(Nil)
Used to create a generic promise if all we care about is success or failure
-
#type : Class
Interfaces available to generic types
-
#type_var
A cool hack to grab the promise type
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
Instance Method Detail
def catch(&errback : Exception -> Exception | Input | DeferredPromise(Input) | RejectedPromise(Input) | ResolvedPromise(Input))
#
Callback to execute if an error occurs
def then : DeferredPromise(Nil)
#
Used to create a generic promise if all we care about is success or failure
def type : Class
#
Description copied from class Promise(Input)
Interfaces available to generic types