Liking cljdoc? Tell your friends :D

bangmod.http-api.request

One execute request end to end — numbered, sent, retried once on a stale token, then delivered to its own channel and (if it is still the latest) to the endpoint's slot — with the transport passed in. Kept free of ajax.core and reagent so it can be unit-tested: :node-test has no XMLHttpRequest (the same reason retry.cljc and sse.cljc are separate).

One `execute` request end to end — numbered, sent, retried once on a stale token, then
delivered to its own channel and (if it is still the latest) to the endpoint's slot —
with the transport passed in. Kept free of `ajax.core` and reagent so it can be
unit-tested: `:node-test` has no XMLHttpRequest (the same reason `retry.cljc` and
`sse.cljc` are separate).
raw docstring

into-slotclj/s

(into-slot prev result)

The slot's next value once result arrives. The slot keeps the last GOOD :data across failures — a UI bound to the reaction must not go blank because one refresh failed. The failure itself lands under :error.

The slot's next value once `result` arrives. The slot keeps the last GOOD :data across
failures — a UI bound to the reaction must not go blank because one refresh failed. The
failure itself lands under :error.
sourceraw docstring

latest?clj/s

(latest? a-sent path n)

Is request n still the latest sent to the endpoint at path?

Is request `n` still the latest sent to the endpoint at `path`?
sourceraw docstring

number!clj/s

(number! a-sent path)

Numbers a new request to the endpoint at path ([api-name endpoint-name]) — one counter per endpoint in a-sent — and returns its number. That number is the endpoint's latest until the next request to it is numbered.

Numbers a new request to the endpoint at `path` ([api-name endpoint-name]) — one counter
per endpoint in `a-sent` — and returns its number. That number is the endpoint's latest
until the next request to it is numbered.
sourceraw docstring

send!clj/s

(send! {:keys [a-data a-sent path fire!]})

Sends one request and returns a chan 1 that receives its result.

fire! is the transport: (fn [on-result]), called once per attempt, sending the request (rebuilt, so a retry carries the reloaded token) and calling on-result with {:success? bool :data ...} when it answers.

The request is numbered for the endpoint at path in a-sent before it is sent. Its result goes into the slot in a-data only while that number is still the latest — an answer to a superseded request never replaces the slot, whichever order the answers arrive in. The channel always gets the request's own result. The stale-token retry is the same request: it keeps the number.

Sends one request and returns a `chan 1` that receives its result.

`fire!` is the transport: `(fn [on-result])`, called once per attempt, sending the
request (rebuilt, so a retry carries the reloaded token) and calling `on-result` with
{:success? bool :data ...} when it answers.

The request is numbered for the endpoint at `path` in `a-sent` before it is sent. Its
result goes into the slot in `a-data` only while that number is still the latest — an
answer to a superseded request never replaces the slot, whichever order the answers
arrive in. The channel always gets the request's own result. The stale-token retry is
the same request: it keeps the number.
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