Skip to content

Discuss: Injecting effects #2

@jamesnvc

Description

@jamesnvc

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?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions