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 you write code that waits for answers only 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 you write code that waits for answers only 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 (in ClojureScript a promise of it). On the JVM it returns once every future has its value, and the futures run at once.

With f, every call is under way before it waits for any, e.g. (all force [(delay (a!)) (delay (b!))]) runs a! and b! 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 (in ClojureScript a promise of
it). On the JVM it returns once every future has its value, and the
futures run at once.

With `f`, every call is under way before it waits for any, e.g.
(all force [(delay (a!)) (delay (b!))]) runs a! and b! at once.
sourceraw docstring

attemptclj/s

(attempt f)

The result of calling f as a map of its :value, in a future on the JVM and a promise in ClojureScript. 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. a StackOverflowError from deeply nested input, as anything thrown does in ClojureScript.

The result of calling `f` as a map of its :value, in a future on the
JVM and a promise in ClojureScript. 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. a StackOverflowError from 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 JDK's client and Node's fetch put 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 JDK's client and Node's fetch put 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, with n calls at a time (in ClojureScript a promise of it).

The results of `f` on each of `xs` as a vector, with `n` calls at a time
(in ClojureScript a promise of it).
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 returns for step! and opts, as a vector of at most :limit values (in ClojureScript a promise of it).

The opts are the :somef, :vf, :kf and :initk of clojure.core/iteration, and :limit. The step! function returns a value, a future or a promise, so the same code pages through an API on both platforms, as in the example of clojure.core/iteration:

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

The `opts` are the :somef, :vf, :kf and :initk of
clojure.core/iteration, and :limit. The `step!` function returns a
value, a future or a promise, so the same code pages through an API on
both platforms, as in the example of clojure.core/iteration:

    (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 returns it (in ClojureScript a promise of it).

Each call of f returns a value, a future or a promise. The calls go one at a time, so it makes none after the first true result.

The first logical true result of `f` on the `xs`, or nil, as
clojure.core/some returns it (in ClojureScript a promise of it).

Each call of `f` returns a value, a future or a promise. The calls go
one at a time, so it makes none after the first true result.
sourceraw docstring

thenclj/s

(then x f)

The result of f on the value of x (in ClojureScript a promise of it). The x is a value, a future on the JVM or a promise in ClojureScript.

The result of `f` on the value of `x` (in ClojureScript a promise of
it). The `x` is a value, a future on the JVM or a promise in
ClojureScript.
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