(all promises)
Given an array of promises, return a promise that is fulfilled when all the items in the array are fulfilled.
Given an array of promises, return a promise that is fulfilled when all the items in the array are fulfilled.
(any promises)
Given an array of promises, return a promise that is fulfilled when first one item in the array is fulfilled.
Given an array of promises, return a promise that is fulfilled when first one item in the array is fulfilled.
(bind p callback)
A chain helper for promises.
A chain helper for promises.
(cancelled? v)
Return true if v
is a cancelled promise.
Return true if `v` is a cancelled promise.
(catch p f)
(catch p type f)
Catch all promise chain helper.
Catch all promise chain helper.
(chain p & funcs)
Like then but accepts multiple parameters.
Like then but accepts multiple parameters.
(delay t)
(delay t v)
Given a timeout in miliseconds and optional value, returns a promise that will fulfilled with provided value (or nil) after the time is reached.
Given a timeout in miliseconds and optional value, returns a promise that will fulfilled with provided value (or nil) after the time is reached.
(done? p)
Returns true if promise p
is already done.
Returns true if promise `p` is already done.
(error f p)
(error f type p)
Same as catch
but with parameters inverted.
Same as `catch` but with parameters inverted.
(extract p)
Returns the current promise value.
Returns the current promise value.
(finally p callback)
Attach handler to promise that will be executed independently if promise is resolved or rejected.
Attach handler to promise that will be executed independently if promise is resolved or rejected.
A cancellation abstraction.
A cancellation abstraction.
(-cancel _)
(-cancelled? _)
A basic future abstraction.
A basic future abstraction.
(-map _ callback)
Chain a promise.
Chain a promise.
(-catch _ callback)
Catch a error in a promise.
Catch a error in a promise.
(-bind _ callback)
Chain a promise.
Chain a promise.
A promise constructor abstraction.
A promise constructor abstraction.
(-promise _)
Create a promise instance.
Create a promise instance.
Additional state/introspection abstraction.
Additional state/introspection abstraction.
(-extract _)
Extract the current value.
Extract the current value.
(-pending? _)
Retutns true if a promise is pending.
Retutns true if a promise is pending.
(-rejected? _)
Returns true if a promise is rejected.
Returns true if a promise is rejected.
(-resolved? _)
Returns true if a promise is resolved.
Returns true if a promise is resolved.
(map f p)
Apply a function to the promise value and return a new promise with the result.
Apply a function to the promise value and return a new promise with the result.
(mapcat f p)
Same as map
but removes one level of
promise neesting. Useful when the map function
returns a promise instead of value.
In JS environment this function is analogous
to map
because the promise abstraction overloads
the map
operator.
Same as `map` but removes one level of promise neesting. Useful when the map function returns a promise instead of value. In JS environment this function is analogous to `map` because the promise abstraction overloads the `map` operator.
(pending? p)
Returns true if promise p
is stil pending.
Returns true if promise `p` is stil pending.
(promise? v)
Return true if v
is a promise instance.
Return true if `v` is a promise instance.
(promisify callable)
Given a function that accepts a callback as the last argument return other function that returns a promise. Callback is expected to take single parameter (result of a computation).
Given a function that accepts a callback as the last argument return other function that returns a promise. Callback is expected to take single parameter (result of a computation).
(rejected v)
Return a rejected promise with provided reason.
Return a rejected promise with provided reason.
(rejected? p)
Returns true if promise p
is already rejected.
Returns true if promise `p` is already rejected.
(resolved v)
Return a resolved promise with provided value.
Return a resolved promise with provided value.
(resolved? p)
Returns true if promise p
is already fulfilled.
Returns true if promise `p` is already fulfilled.
(schedule ms func)
Schedule a callable to be executed after the ms
delay
is reached.
In JVM it uses a scheduled executor service and in JS
it uses the setTimeout
function.
Schedule a callable to be executed after the `ms` delay is reached. In JVM it uses a scheduled executor service and in JS it uses the `setTimeout` function.
(then p f)
Same as map
but with parameters inverted
for convenience and for familiarity with
javascript's promises .then
operator.
Same as `map` but with parameters inverted for convenience and for familiarity with javascript's promises `.then` operator.
(timeout p t)
(timeout p t v)
Returns a cancellable promise that will be fulfilled
with this promise's fulfillment value or rejection reason.
However, if this promise is not fulfilled or rejected
within ms
milliseconds, the returned promise is cancelled
with a TimeoutError
Returns a cancellable promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is cancelled with a TimeoutError
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close