Skip to content

Commit

Permalink
emit action event as a record
Browse files Browse the repository at this point in the history
  • Loading branch information
duck1123 committed Jan 5, 2015
1 parent b19aa14 commit 985e771
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ciste/core.clj
Expand Up @@ -55,6 +55,8 @@ Rebind this var to set the format for the current request."}
(with-format ~format
~@body)))

(defrecord ActionEvent [action args records])

(defmacro defaction
"Define an Action.
Expand All @@ -70,13 +72,11 @@ the action channel, it logs it's execution."
~docs
[& params#]
(let [~args params#
action# (var ~name)]
(when (config :print :actions) (log/info action#))
(let [records# (do ~@forms)]
;; TODO: Find a good way to hook these kind of things
(when (config :use-pipeline)
(l/enqueue *actions* {:action action# :args params# :records records#}))
records#)))
action# (var ~name)
records# (do ~@forms)]
(l/enqueue *actions*
(ActionEvent. action# params# records#))
records#))
(alter-meta! (var ~name) assoc :arglists '(~args))
(var ~name))))

Expand Down

0 comments on commit 985e771

Please sign in to comment.