(build spec)
Given a spec return a map of similar structure replacing it's values with derived atoms built based on the depedency information encoded in the spec
WARNING: This will create derived atoms for all keys so it may lead
to some uneccesary computations To avoid this issue consider using
derivatives-pool
which manages derivatives in a registry
removing them as soon as they become unused
Given a spec return a map of similar structure replacing it's values with derived atoms built based on the depedency information encoded in the spec WARNING: This will create derived atoms for all keys so it may lead to some uneccesary computations To avoid this issue consider using `derivatives-pool` which manages derivatives in a registry removing them as soon as they become unused
(calc-deps graph ks)
Calculate all dependencies for ks
and return a set with the dependencies and ks
Calculate all dependencies for `ks` and return a set with the dependencies and `ks`
(depend' graph node deps)
Variation of depend
that takes a list of dependencies instead of one
Variation of `depend` that takes a list of dependencies instead of one
(derivatives-pool spec)
Given a derivatives spec return a map with get!
and free!
functions.
derivative-id
registering the usage with token
derivative-id
is no longer needed by token
, if there are no more tokens needing
the derivative it will be removedGiven a derivatives spec return a map with `get!` and `free!` functions. - (get! derivative-id token) will retrieve a derivative for `derivative-id` registering the usage with `token` - (free! derivative-id token) will indicate the derivative `derivative-id` is no longer needed by `token`, if there are no more tokens needing the derivative it will be removed
(drv & drv-ks)
Rum mixin to retrieve derivatives for drv-ks
using the functions in the component context
To get the derived-atom use get-ref
for swappable client/server behavior
Rum mixin to retrieve derivatives for `drv-ks` using the functions in the component context To get the derived-atom use `get-ref` for swappable client/server behavior
(get-ref state drv-k)
Get the derivative identified by drv-k
from the component state.
When rendering in Clojure this looks for drv-k
in the dynvar *derivatives
Get the derivative identified by `drv-k` from the component state. When rendering in Clojure this looks for `drv-k` in the dynvar `*derivatives`
(release! this drv-k token)
(get! this drv-k token)
(react state drv-k)
Like get-ref
wrapped in rum.core/react
Like `get-ref` wrapped in `rum.core/react`
(react-all state & ks)
React to multiple derivatives in the components state.
If any ks
are passed, react to those and return their values
in a map. If no ks
is passed return all available derivatives
deref'ed as a map.
React to multiple derivatives in the components state. If any `ks` are passed, react to those and return their values in a map. If no `ks` is passed return all available derivatives deref'ed as a map.
(rum-derivatives spec)
Given the passed spec add get!/release! derivative functions to
the child context so they can be seen by components using the deriv
mixin.
Given the passed spec add get!/release! derivative functions to the child context so they can be seen by components using the `deriv` mixin.
(rum-derivatives* get-spec-fn)
Like rum-derivatives but get the spec from the arguments passed to the components (:rum/args
) using get-spec-fn
Like rum-derivatives but get the spec from the arguments passed to the components (`:rum/args`) using `get-spec-fn`
(spec->graph spec)
Turn a given spec into a dependency graph
Turn a given spec into a dependency graph
(sync-derivatives! spec watch-key-prefix drv-map order)
Update the derivatives map drv-map
so that all keys passed in order
are statisfied and any superfluous keys are removed.
Values of superfluous keys that implement IDisposable they will also be disposed.
Update the derivatives map `drv-map` so that all keys passed in `order` are statisfied and any superfluous keys are removed. Values of superfluous keys that implement IDisposable they will also be disposed.
(watchable? x)
Platform-agnostic helper to determine if something is watchable (atom, etc)
Platform-agnostic helper to determine if something is watchable (atom, etc)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close