Skip to content

Commit

Permalink
add dispatch assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
roman01la committed Jul 27, 2018
1 parent 2253168 commit 7819582
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/citrus/reconciler.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@

IReconciler
(dispatch! [this cname event args]
(assert (contains? controllers cname) (str "Controller " cname " is not found"))
(assert (-> (get controllers cname) methods (contains? event))
(str "Controller " cname " doesn't declare " event " method"))

(queue-effects!
queue
[cname event #((get controllers cname) event args (get %1 cname) %2)])
Expand Down Expand Up @@ -91,6 +95,10 @@
(reset! state next-state)))))

(dispatch-sync! [this cname event args]
(assert (contains? controllers cname) (str "Controller " cname " is not found"))
(assert (-> (get controllers cname) methods (contains? event))
(str "Controller " cname " doesn't declare " event " method"))

(let [ctrl (get controllers cname)
cofx (get-in (.-meta ctrl) [:citrus event :cofx])
cofx (reduce
Expand Down

0 comments on commit 7819582

Please sign in to comment.