Currently, the :effect of an event can perform arbitrary side-effects.
It would probably be better if that was contained in some way. One approach would be a re-frame style of returning a map of "fx", but that has the downside of not being easily composable. The current leading thought is to pass in some sort of object for each "fx" desired, which is injected when called.
e.g.
(register-events!
{:id :foo
:params ...
:conditions ...
:injections [:tada/db] ;; ???
:effect (fn [params db] ;; ???
(db :save-foo! params))})
To discuss:
- Is this reasonable?
- What is
db in the example above? (something conforming to some kind of Db protocol?)
- How is it injected? (in
do!? As a reify'd Db?)
Currently, the
:effectof an event can perform arbitrary side-effects.It would probably be better if that was contained in some way. One approach would be a re-frame style of returning a map of "fx", but that has the downside of not being easily composable. The current leading thought is to pass in some sort of object for each "fx" desired, which is injected when called.
e.g.
To discuss:
dbin the example above? (something conforming to some kind ofDbprotocol?)do!? As areify'dDb?)