Liking cljdoc? Tell your friends :D

barebuild.consumer-resource


own-write?cljs

(own-write? consumer view)

True when the write view reports is the one this consumer submitted. A write moves :writing? for every consumer the resource drives, so one acting on that movement asks this first.

True when the write `view` reports is the one this consumer submitted. A write moves `:writing?`
for every consumer the resource drives, so one acting on that movement asks this first.
sourceraw docstring

register!cljs

(register! {:keys [tag child-tag on-connect] :as config})

Register a resource-consumer custom element from a config: :tag element tag name :child-tag the driven child element, cached on connect and handed to every hook :render (fn [child view this]), optional, called when the render-key slice changes :render-key (fn [view]) -> the slice render draws. Defaults to the accepted envelope :on-failure (fn [child view this]), optional, called when :failure changes, with :failure nil on recovery so the component can clear its UI :on-pending (fn [child view this]), optional, called when :pending? changes :on-writing (fn [child view this]), optional, called when :writing? changes :on-connect (fn [child this]), optional extra wiring

view is the whole of what a consumer may read: {:accepted :failure :intent :pending? :writing? :write}. Every hook is handed all of it, its slice deciding only when it fires: once on the first apply, then only when that slice moves. A consumer drives its child from the view alone and never from an attribute, so it observes none.

Register a resource-consumer custom element from a config:
:tag        element tag name
:child-tag  the driven child element, cached on connect and handed to every hook
:render     (fn [child view this]), optional, called when the render-key slice changes
:render-key (fn [view]) -> the slice render draws. Defaults to the accepted envelope
:on-failure (fn [child view this]), optional, called when :failure changes, with :failure nil
            on recovery so the component can clear its UI
:on-pending (fn [child view this]), optional, called when :pending? changes
:on-writing (fn [child view this]), optional, called when :writing? changes
:on-connect (fn [child this]), optional extra wiring

`view` is the whole of what a consumer may read:
{:accepted :failure :intent :pending? :writing? :write}. Every hook is handed all of it, its slice
deciding only when it fires: once on the first apply, then only when that slice moves. A consumer
drives its child from the view alone and never from an attribute, so it observes none.
sourceraw docstring

submit-intent!cljs

(submit-intent! consumer patch)
(submit-intent! consumer patch target-id)

Send an intent patch from a gesture handler back to a server-resource. With no target-id the patch drives the consumer's own resource, with one it drives the named sibling through its URL projection.

Send an intent patch from a gesture handler back to a server-resource. With no `target-id` the
patch drives the consumer's own resource, with one it drives the named sibling through its URL
projection.
sourceraw docstring

submit-refresh!cljs

(submit-refresh! consumer)

Ask the server-resource to read the current intent again. For a gesture that wants the same question answered afresh rather than a different question asked: the intent does not move, the URL is not written, and what the resource holds stands until an answer replaces it. A read already in flight already answers this, so one is not opened on top of it.

Ask the server-resource to read the current intent again. For a gesture that wants the same
question answered afresh rather than a different question asked: the intent does not move, the
URL is not written, and what the resource holds stands until an answer replaces it. A read
already in flight already answers this, so one is not opened on top of it.
sourceraw docstring

submit-write!cljs

(submit-write! consumer payload)

Send a write from a gesture handler back to the server-resource. The payload is stamped with the consumer's tag as its :submitter unless it already names one. The stamp never reaches the server: a request body is built from :record alone.

Send a write from a gesture handler back to the server-resource. The payload is stamped with the
consumer's tag as its `:submitter` unless it already names one. The stamp never reaches the
server: a request body is built from `:record` alone.
sourceraw docstring

viewcljs

(view consumer)

The view this consumer was last applied, or nil before the first apply. What a gesture handler reads, since it fires from the DOM and is handed no view of its own.

The view this consumer was last applied, or nil before the first apply. What a gesture handler
reads, since it fires from the DOM and is handed no view of its own.
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