Liking cljdoc? Tell your friends :D

space.matterandvoid.subscriptions.core


<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.
sourceraw docstring

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
sourceraw 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.
sourceraw docstring

datasource-contextcljs

source

deflayer2-subclj/smacro

(deflayer2-sub sub-name ?path)

Only supports use cases where your datasource is a hashmap.

Takes a symbol for a subscription name and a way to derive a path in your datasource hashmap. 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])))

Only supports use cases where your datasource is a hashmap.

Takes a symbol for a subscription name and a way to derive a path in your datasource hashmap. 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 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 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. 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.
sourceraw docstring

reg-layer2-subclj/s

(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.
sourceraw docstring

reg-sub-rawclj/s

(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>
sourceraw docstring

set-args-merge-fn!clj/s

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

set-memoize-fn!clj/s

(set-memoize-fn! f)
source

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.
sourceraw 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
sourceraw docstring

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

× close