Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss: Injecting effects #2

Open
jamesnvc opened this issue Sep 25, 2019 · 0 comments
Open

Discuss: Injecting effects #2

jamesnvc opened this issue Sep 25, 2019 · 0 comments
Labels
question Further information is requested

Comments

@jamesnvc
Copy link
Collaborator

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?)
@jamesnvc jamesnvc added the question Further information is requested label Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant