Skip to content

Commit

Permalink
allow parameteriziation of default interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
martinklepsch committed Dec 27, 2016
1 parent 64b9d29 commit 65209c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/re_frame/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
{:registry registry
:event-queue event-queue
:app-db re-frame.db/app-db
:subs-cache subs-cache})))
:subs-cache subs-cache
:default-interceptors [(cofx/inject-cofx registry :db) (fx/do-fx registry)]})))

(def the-frame (make-frame))

Expand Down
8 changes: 4 additions & 4 deletions src/re_frame/frame.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
[this id interceptors handler]))

;; connect all the pieces of state ----
(defrecord Frame [registry event-queue app-db subs-cache]
(defrecord Frame [registry event-queue app-db subs-cache default-interceptors]
IFrame
;; dispatch ----
(dispatch [this event-v]
Expand Down Expand Up @@ -95,18 +95,18 @@
(events/register
registry
id
[(cofx/inject-cofx registry :db) (fx/do-fx registry) interceptors (stdi/db-handler->interceptor db-handler)]))
[default-interceptors interceptors (stdi/db-handler->interceptor db-handler)]))
(reg-event-fx [this id fx-handler]
(reg-event-fx this id nil fx-handler))
(reg-event-fx [this id interceptors fx-handler]
(events/register
registry
id
[(cofx/inject-cofx registry :db) (fx/do-fx registry) interceptors (stdi/fx-handler->interceptor fx-handler)]))
[default-interceptors interceptors (stdi/fx-handler->interceptor fx-handler)]))
(reg-event-ctx [this id handler]
(reg-event-ctx this id nil handler))
(reg-event-ctx [this id interceptors handler]
(events/register
registry
id
[(cofx/inject-cofx registry :db) (fx/do-fx registry) interceptors (stdi/ctx-handler->interceptor handler)])))
[default-interceptors interceptors (stdi/ctx-handler->interceptor handler)])))

0 comments on commit 65209c3

Please sign in to comment.