Skip to content

Instantly share code, notes, and snippets.

@mfikes
Created May 6, 2018 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfikes/a038523049e35699f7699a1c7ff8a3c4 to your computer and use it in GitHub Desktop.
Save mfikes/a038523049e35699f7699a1c7ff8a3c4 to your computer and use it in GitHub Desktop.
(defn take-effect [{:keys [chan on-success on-failure]}]
(go
(try
(dispatch (conj on-success (<? chan)))
(catch :default e
(dispatch (conj on-failure e)))))
nil)
(reg-fx :take take-effect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment