Liking cljdoc? Tell your friends :D

space.matterandvoid.subscriptions.fulcro


<subclj/s

(<sub ?app query)

Subscribe and deref a subscription, returning its value, not a reaction.

Subscribe and deref a subscription, returning its value, not a reaction.
source (clj)source (cljs)raw docstring

cleanup!clj

(cleanup! this)

Intended to be called when a component unmounts to clear the registered Reaction.

Intended to be called when a component unmounts to clear the registered Reaction.
sourceraw docstring

clear-handlersclj/s

(clear-handlers app)
(clear-handlers app id)
source (clj)source (cljs)

clear-subclj/s

(clear-sub registry)
(clear-sub registry query-id)

Unregisters subscription handlers (presumably registered previously via the use of reg-sub).

When called with no args, it will unregister all currently registered subscription handlers.

When given one arg, assumed to be the id of a previously registered subscription handler, it will unregister the associated handler. Will produce a warning to console if it finds no matching registration.

NOTE: Depending on the usecase, it may be necessary to call clear-subscription-cache! afterwards

Unregisters subscription handlers (presumably registered previously via the use of `reg-sub`).

When called with no args, it will unregister all currently registered subscription handlers.

When given one arg, assumed to be the `id` of a previously registered
subscription handler, it will unregister the associated handler. Will produce a warning to
console if it finds no matching registration.

NOTE: Depending on the usecase, it may be necessary to call `clear-subscription-cache!` afterwards
source (clj)source (cljs)raw docstring

clear-subscription-cache!clj/s

(clear-subscription-cache! registry)

Removes all subscriptions from the cache.

This function can be used at development time or test time. Useful when hot reloading namespaces containing subscription handlers. Also call it after a React/render exception, because React components won't have been cleaned up properly. And this, in turn, means the subscriptions within those components won't have been cleaned up correctly. So this forces the issue.

Removes all subscriptions from the cache.

This function can be used at development time or test time. Useful when hot reloading
namespaces containing subscription handlers. Also call it after a React/render exception,
because React components won't have been cleaned up properly. And this, in turn, means
the subscriptions within those components won't have been cleaned up correctly. So this
forces the issue.
source (clj)source (cljs)raw docstring

datasource-contextcljs

source

deflayer2-subclj/smacro

(deflayer2-sub sub-name ?path)

Takes a symbol for a subscription name and a way to derive a path in your fulcro app db. Returns a function subscription which itself returns a Reagent RCursor. Supports a vector path, a single keyword, or a function which takes the RAtom datasource and the arguments map passed to subscribe and must return a path vector to use as an RCursor path.

Examples:

(deflayer2-sub my-subscription :a-path-in-your-db)

(deflayer2-sub my-subscription [:a-path-in-your-db])

(deflayer2-sub my-subscription (fn [db-atom sub-args-map] [:a-key (:some-val sub-args-map])))

Takes a symbol for a subscription name and a way to derive a path in your fulcro app db. Returns a function subscription
which itself returns a Reagent RCursor.
Supports a vector path, a single keyword, or a function which takes the RAtom datasource and the arguments map passed to subscribe and
must return a path vector to use as an RCursor path.

Examples:

(deflayer2-sub my-subscription :a-path-in-your-db)

(deflayer2-sub my-subscription [:a-path-in-your-db])

(deflayer2-sub my-subscription (fn [db-atom sub-args-map] [:a-key (:some-val sub-args-map])))
sourceraw docstring

defregsubclj/smacro

(defregsub sub-name & args)

Has the same function signature as reg-sub. Registers a subscription and creates a function which is invokes subscribe and deref on the registered subscription with the args map passed in.

Has the same function signature as `reg-sub`.
Registers a subscription and creates a function which is invokes subscribe and deref on the registered subscription
with the args map passed in.
sourceraw docstring

defsubclj/smacro

(defsub fn-name & args)

Has the same function signature as reg-sub without a keyword name argument. Returns a subscription function and creates a function which invokes subscribe and deref on the registered subscription with the args map passed in.

Has the same function signature as `reg-sub` without a keyword name argument.
Returns a subscription function and creates a function which invokes subscribe and deref on the registered subscription
with the args map passed in.
sourceraw docstring

defsubrawclj/smacro

(defsubraw sub-name args body)

Creates a subscription function that takes the datasource ratom and optionally an args map and returns a Reaction.

Creates a subscription function that takes the datasource ratom and optionally an args map and returns a Reaction.
sourceraw docstring

make-sub-fnclj/s

(make-sub-fn query-id sub-args)
source (clj)source (cljs)

query-keyclj

source

reg-layer2-subcljs

(reg-layer2-sub query-id path-vec-or-fn)

Registers a handler function that returns a Reagent RCursor instead of a Reagent Reaction. Accepts a single keyword, a vector path into or a function which takes your db atom and arguments map passed to subscribe and must return a vector path to be used for the cursor.

Registers a handler function that returns a Reagent RCursor instead of a Reagent Reaction.
Accepts a single keyword, a vector path into or a function which takes your db atom and arguments map passed to subscribe
and must return a vector path to be used for the cursor.
sourceraw docstring

reg-subclj/s

(reg-sub query-id & args)

A call to reg-sub associates a query-id with two functions -> a function returning input signals and a function (the signals function) taking the input-signals current value(s) as input and returning a value (the computation function).

The two functions provide 'a mechanism' for creating a node in the Signal Graph. When a node of type query-id is needed, the two functions can be used to create it.

The three arguments are:

  • query-id - typically a namespaced keyword (later used in subscribe)
  • optionally, an input signals function which returns the input data flows required by this kind of node.
  • a computation function which computes the value (output) of the node (from the input data flows)

It registers 'a mechanism' (the two functions) by which nodes can be created later, when a node is bought into existence by the use of subscribe in a View Functionreg-sub.

The computation function is expected to take two arguments:

  • input-values - the values which flow into this node (how is it wired into the graph?)
  • query-vector - the vector given to subscribe

and it returns a computed value (which then becomes the output of the node)

When computation function is called, the 2nd query-vector argument will be that vector supplied to the subscribe. So, if the call was (subscribe [:sub-id 3 :blue]), then the query-vector supplied to the computaton function will be [:sub-id 3 :blue].

The argument(s) supplied to reg-sub between query-id and the computation-function can vary in 3 ways, but whatever is there defines the input signals part of the mechanism, specifying what input values "flow into" the computation function (as the 1st argument) when it is called.

A call to `reg-sub` associates a `query-id` with two functions ->
a function returning input signals and a function (the signals function)
taking the input-signals current value(s) as input and returning a value (the computation function).

The two functions provide 'a mechanism' for creating a node
in the Signal Graph. When a node of type `query-id` is needed,
the two functions can be used to create it.

The three arguments are:

- `query-id` - typically a namespaced keyword (later used in subscribe)
- optionally, an `input signals` function which returns the input data
  flows required by this kind of node.
- a `computation function` which computes the value (output) of the
  node (from the input data flows)

It registers 'a mechanism' (the two functions) by which nodes
can be created later, when a node is bought into existence by the
use of `subscribe` in a `View Function`reg-sub.

The `computation function` is expected to take two arguments:

  - `input-values` - the values which flow into this node (how is it wired into the graph?)
  - `query-vector` - the vector given to `subscribe`

and it returns a computed value (which then becomes the output of the node)

When `computation function` is called, the 2nd `query-vector` argument will be that
vector supplied to the `subscribe`. So, if the call was `(subscribe [:sub-id 3 :blue])`,
then the `query-vector` supplied to the computaton function will be `[:sub-id 3 :blue]`.

The argument(s) supplied to `reg-sub` between `query-id` and the `computation-function`
can vary in 3 ways, but whatever is there defines the `input signals` part
of `the mechanism`, specifying what input values "flow into" the
`computation function` (as the 1st argument) when it is called.
source (clj)source (cljs)raw docstring

reg-sub-rawclj/s≠

(reg-sub-raw query-id handler-fn)
clj

This is a low level, advanced function. You should probably be using reg-sub instead.

Some explanation is available in the docs at <a href="http://day8.github.io/re-frame/flow-mechanics/" target="_blank">http://day8.github.io/re-frame/flow-mechanics/</a>

This is a low level, advanced function.  You should probably be
using `reg-sub` instead.

Some explanation is available in the docs at
<a href="http://day8.github.io/re-frame/flow-mechanics/" target="_blank">http://day8.github.io/re-frame/flow-mechanics/</a>
cljs

Registers a function with the subscription id query-id. The function takes the source data RAtom and optional args map and is expected to return a Reagent Reaction or Cursor.

Registers a function with the subscription id `query-id`. The function takes the source data RAtom and optional
args map and is expected to return a Reagent Reaction or Cursor.
source (clj)source (cljs)raw docstring

set-args-merge-fn!clj/s

(set-args-merge-fn! f)
source (clj)source (cljs)

set-memoize-fn!clj/s

(set-memoize-fn! f)
source (clj)source (cljs)

setup-reaction!clj

(setup-reaction! this client-render)

Installs a Reaction on the provided component which will re-render the component when any of the subscriptions' values change. Takes a component instance and a render function with signature: (fn render [this])

Installs a Reaction on the provided component which will re-render the component when any of the subscriptions'
values change.
Takes a component instance and a render function with signature: (fn render [this])
sourceraw docstring

sub-fnclj/s

(sub-fn f)

Takes a function that returns either a Reaction or RCursor. Returns a function that when invoked delegates to f and derefs its output. The returned function can be used in subscriptions.

Takes a function that returns either a Reaction or RCursor. Returns a function that when invoked delegates to `f` and
derefs its output. The returned function can be used in subscriptions.
source (clj)source (cljs)raw docstring

subscribeclj/s

(subscribe ?app query)

Given a query vector, returns a Reagent reaction which will, over time, reactively deliver a stream of values. Also known as a Signal.

To obtain the current value from the Signal, it must be dereferenced

Given a `query` vector, returns a Reagent `reaction` which will, over
time, reactively deliver a stream of values. Also known as a `Signal`.

To obtain the current value from the Signal, it must be dereferenced
source (clj)source (cljs)raw docstring

with-headless-fulcroclj/s

(with-headless-fulcro app)

Takes a fulcro app, disables all UI rendering and replaces the state atom with a Reagent RAtom.

Takes a fulcro app, disables all UI rendering and replaces the state atom with a Reagent RAtom.
source (clj)source (cljs)raw docstring

with-nameclj/s

(with-name f sub-name)
source (clj)source (cljs)

with-reactive-subscriptionsclj

(with-reactive-subscriptions app)

Takes a fulcro app and adds support for using subscriptions The components which deref subscriptions in their render bodies will be refreshed when those subscriptions change, separate from the fulcro rendering mechanism.

  • Adds render middleware to run-in-reaction for class components
  • Adds cleanup when a component is unmounted
  • Changes the state atom to be a reagent.ratom/atom
  • Changes the `optimized-render! algorithm to be the ident-optmized-render algorithm.
Takes a fulcro app and adds support for using subscriptions
  The components which deref subscriptions in their render bodies will be refreshed when those subscriptions change,
  separate from the fulcro rendering mechanism.
- Adds render middleware to run-in-reaction for class components
- Adds cleanup when a component is unmounted
- Changes the state atom to be a reagent.ratom/atom
- Changes the `optimized-render! algorithm to be the ident-optmized-render algorithm.
sourceraw docstring

with-subscriptionsclj

(with-subscriptions app)

Takes a fulcro app and adds support for using subscriptions

  • Adds render middleware to run-in-reaction for class components
  • Adds cleanup when a component is unmounted
  • Changes the state atom to be a reagent.ratom/atom
  • Changes the `optimized-render! algorithm to be the ident-optmized-render algorithm.
Takes a fulcro app and adds support for using subscriptions
- Adds render middleware to run-in-reaction for class components
- Adds cleanup when a component is unmounted
- Changes the state atom to be a reagent.ratom/atom
- Changes the `optimized-render! algorithm to be the ident-optmized-render algorithm.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close