(cache-and-return query-v dynv r)
cache the reaction r
cache the reaction r
(clear-all-handlers!)
Unregisters all existing subscription handlers
Unregisters all existing subscription handlers
(clear-subscription-cache!)
Runs on-dispose for all subscriptions we have in the subscription cache. Used to force recreation of new subscriptions. Should only be necessary in development.
The on-dispose functions for the subscriptions will remove themselves from the cache.
Useful when reloading Figwheel code after a React exception, as React components aren't cleaned up properly. This means a subscription's on-dispose function isn't run when the components are destroyed. If a bad subscription caused your exception, then you can't fix it without reloading your browser.
Runs on-dispose for all subscriptions we have in the subscription cache. Used to force recreation of new subscriptions. Should only be necessary in development. The on-dispose functions for the subscriptions will remove themselves from the cache. Useful when reloading Figwheel code after a React exception, as React components aren't cleaned up properly. This means a subscription's on-dispose function isn't run when the components are destroyed. If a bad subscription caused your exception, then you can't fix it without reloading your browser.
(reg-sub query-id & args)
Associate the given query id
with a handler function and an optional signal function.
There's 3 ways this function can be called
(reg-sub :test-sub (fn [db [_]] db)) The value in app-db is passed to the computation function as the 1st argument.
(reg-sub :a-b-sub (fn [q-vec d-vec] [(subs/subscribe [:a-sub]) (subs/subscribe [:b-sub])]) (fn [[a b] [_]] {:a a :b b}))
Two functions provided. The 2nd is computation function, as before. The 1st
is returns what input signals
should be provided to the computation. The
input signals
function is called with two arguments: the query vector
and the dynamic vector. The return value can be singleton reaction or
a sequence of reactions.
input signals
functions. :<-
is supplied followed by the subscription
vector.Associate the given `query id` with a handler function and an optional signal function. There's 3 ways this function can be called 1. (reg-sub :test-sub (fn [db [_]] db)) The value in app-db is passed to the computation function as the 1st argument. 2. (reg-sub :a-b-sub (fn [q-vec d-vec] [(subs/subscribe [:a-sub]) (subs/subscribe [:b-sub])]) (fn [[a b] [_]] {:a a :b b})) Two functions provided. The 2nd is computation function, as before. The 1st is returns what `input signals` should be provided to the computation. The `input signals` function is called with two arguments: the query vector and the dynamic vector. The return value can be singleton reaction or a sequence of reactions. 3. (reg-sub :a-b-sub :<- [:a-sub] :<- [:b-sub] (fn [[a b] [_]] {:a a :b b}))``` This 3rd variation is just syntactic sugar for the 2nd. Pairs are supplied instead of an `input signals` functions. `:<-` is supplied followed by the subscription vector.
(subscribe query-v)
(subscribe v dynv)
Returns a Reagent/reaction which contains a computation
Returns a Reagent/reaction which contains a computation
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close