(<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.
(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.
(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
(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.
(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.
(defsub fn-name & args)
Has the same function signature as reg-sub
.
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`. Returns a subscription function and creates a function which invokes subscribe and deref on the registered subscription with the args map passed in.
(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)input signals
function which returns the input data
flows required by this kind of node.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.
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.
(reg-sub-raw query-id handler-fn)
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>
(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])
(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.
(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
(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.
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.
(with-subscriptions app)
Takes a fulcro app and adds support for using subscriptions
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 With this version of subscriptions integration with fulcro the intention is that fulcro manages all rendering and subscriptions do not trigger reactive updates - instead they are executed after each fulcro transcation and swap! into the fulcro state atom the derived state that the subscriptions computed (the subscription cache).
Takes a fulcro app and adds support for using subscriptions With this version of subscriptions integration with fulcro the intention is that fulcro manages all rendering and subscriptions do not trigger reactive updates - instead they are executed after each fulcro transcation and swap! into the fulcro state atom the derived state that the subscriptions computed (the subscription cache). - 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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close