Liking cljdoc? Tell your friends :D

dk.simongray.wary-fetch.async

Futures on the JVM and promises in ClojureScript behind one set of functions so that code that waits for answers is written once. The functions take a value, a future or a promise alike.

Futures on the JVM and promises in ClojureScript behind one set of
functions so that code that waits for answers is written once. The
functions take a value, a future or a promise alike.
raw docstring

allclj/s

(all xs)
(all f xs)

The values of xs (each a value, a future or a promise) as a vector, or the results of f on each of them. On the JVM it gives the vector once every future has its value, and the futures run at once. In ClojureScript it gives a promise of it.

With f every call is under way before any is waited for, e.g. (all force [(delay (a!)) (delay (b!))]) makes two different calls at once.

The values of `xs` (each a value, a future or a promise) as a vector,
or the results of `f` on each of them. On the JVM it gives the vector
once every future has its value, and the futures run at once. In
ClojureScript it gives a promise of it.

With `f` every call is under way before any is waited for, e.g.
(all force [(delay (a!)) (delay (b!))]) makes two different calls at
once.
sourceraw docstring

attemptclj/s

(attempt f)

The result of calling f as a map of its :value (in a future or a promise). When f throws (or in ClojureScript rejects), the map has the :error instead.

On the JVM each attempt runs on a future of its own, so several run at once. Errors count too (e.g. the StackOverflowError of deeply nested input), as anything thrown does in ClojureScript.

The result of calling `f` as a map of its :value (in a future or a
promise). When `f` throws (or in ClojureScript rejects), the map has the
:error instead.

On the JVM each attempt runs on a future of its own, so several run at
once. Errors count too (e.g. the StackOverflowError of deeply nested
input), as anything thrown does in ClojureScript.
sourceraw docstring

explainclj/s

(explain e)

The message of the failure e, with the messages of its causes that add to it. The e is an exception, or another value that was thrown.

The client of the JDK and the fetch of Node give the reason that a connection failed in a cause, e.g. a java.net.ConnectException with the cause java.nio.channels.UnresolvedAddressException.

The message of the failure `e`, with the messages of its causes that
add to it. The `e` is an exception, or another value that was thrown.

The client of the JDK and the fetch of Node give the reason that a
connection failed in a cause, e.g. a java.net.ConnectException with the
cause java.nio.channels.UnresolvedAddressException.
sourceraw docstring

in-groupsclj/s

(in-groups f n xs)

The results of f on each of xs as a vector, n calls at a time, in a future or a promise.

The results of `f` on each of `xs` as a vector, `n` calls at a time, in
a future or a promise.
sourceraw docstring

iterationclj/s

(iteration step!
           &
           {:keys [somef vf kf initk limit]
            :or {somef some? vf identity kf identity limit ##Inf}
            :as opts})

The values that clojure.core/iteration gives for step! and opts as a vector of at most :limit values (or in ClojureScript a promise of it).

The opts are the :somef, :vf, :kf and :initk of clojure.core/iteration, and :limit. The step! function gives a value, a future or a promise. So both platforms read an API that answers in pages as the example of clojure.core/iteration does:

(iteration get-page! :initk "a" :vf :items :kf :next-page :limit 10)
The values that clojure.core/iteration gives for `step!` and `opts` as
a vector of at most :limit values (or in ClojureScript a promise of it).

The `opts` are the :somef, :vf, :kf and :initk of
clojure.core/iteration, and :limit. The `step!` function gives a value,
a future or a promise. So both platforms read an API that answers in
pages as the example of clojure.core/iteration does:

    (iteration get-page! :initk "a" :vf :items :kf :next-page :limit 10)
sourceraw docstring

someclj/s

(some f xs)

The first logical true result of f on the xs, or nil, as clojure.core/some gives it. On the JVM it gives the result, and in ClojureScript a promise of it.

Each call of f gives a value, a future or a promise, and the calls go one at a time, so none is made after the first true result.

The first logical true result of `f` on the `xs`, or nil, as
clojure.core/some gives it. On the JVM it gives the result, and in
ClojureScript a promise of it.

Each call of `f` gives a value, a future or a promise, and the calls go
one at a time, so none is made after the first true result.
sourceraw docstring

thenclj/s

(then x f)

The result of f on x once x is a value: at once when it's one or when x (a future on the JVM or a promise in ClojureScript) has its value.

The result of `f` on `x` once `x` is a value: at once when it's one or
when `x` (a future on the JVM or a promise in ClojureScript) has its
value.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close