Liking cljdoc? Tell your friends :D
All platforms.

re-frame.fx


do-fxclj/s

An interceptor whose :after actions the contents of :effects. As a result, this interceptor is Domino 3.

This interceptor is silently added (by reg-event-db etc) to the front of interceptor chains for all events.

For each key in :effects (a map), it calls the registered effects handler (see reg-fx for registration of effect handlers).

So, if :effects was: {:dispatch [:hello 42] :db {...} :undo "set flag"}

it will call the registered effect handlers for each of the map's keys: :dispatch, :undo and :db. When calling each handler, provides the map value for that key - so in the example above the effect handler for :dispatch will be given one arg [:hello 42].

You cannot rely on the ordering in which effects are executed.

An interceptor whose `:after` actions the contents of `:effects`. As a result,
this interceptor is Domino 3.

This interceptor is silently added (by reg-event-db etc) to the front of
interceptor chains for all events.

For each key in `:effects` (a map), it calls the registered `effects handler`
(see `reg-fx` for registration of effect handlers).

So, if `:effects` was:
    {:dispatch  [:hello 42]
     :db        {...}
     :undo      "set flag"}

it will call the registered effect handlers for each of the map's keys:
`:dispatch`, `:undo` and `:db`. When calling each handler, provides the map
value for that key - so in the example above the effect handler for :dispatch
will be given one arg `[:hello 42]`.

You cannot rely on the ordering in which effects are executed.
sourceraw docstring

kindclj/s

source

reg-fxclj/s

(reg-fx id handler)

Register the given effect handler for the given id.

id is keyword, often namespaced. handler is a side-effecting function which takes a single argument and whose return value is ignored.

Example Use

First, registration ... associate :effect2 with a handler.

(reg-fx :effect2 (fn [value] ... do something side-effect-y))

Then, later, if an event handler were to return this effects map ...

{... :effect2 [1 2]}

... then the handler fn we registered previously, using reg-fx, will be called with an argument of [1 2].

Register the given effect `handler` for the given `id`.

`id` is keyword, often namespaced.
`handler` is a side-effecting function which takes a single argument and whose return
value is ignored.

Example Use
-----------

First, registration ... associate `:effect2` with a handler.

(reg-fx
   :effect2
   (fn [value]
      ... do something side-effect-y))

Then, later, if an event handler were to return this effects map ...

{...
 :effect2  [1 2]}

 ... then the `handler` `fn` we registered previously, using `reg-fx`, will be
 called with an argument of `[1 2]`.
sourceraw docstring

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

× close