2015-02-25 11:03:02 +00:00
|
|
|
(ns re-frame.core
|
|
|
|
(:require
|
2015-02-25 11:03:25 +00:00
|
|
|
[re-frame.handlers :as handlers]
|
|
|
|
[re-frame.subs :as subs]
|
2015-03-04 13:00:36 +00:00
|
|
|
[re-frame.router :as router]
|
2015-03-01 20:58:34 +00:00
|
|
|
[re-frame.middleware :as middleware]))
|
2015-02-25 11:03:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
;; -- API -------
|
|
|
|
|
|
|
|
(def register-handler handlers/register)
|
2015-03-04 13:00:36 +00:00
|
|
|
(def dispatch router/dispatch)
|
|
|
|
(def dispatch-sync router/dispatch-sync)
|
2015-02-25 11:03:02 +00:00
|
|
|
|
2015-02-26 03:24:50 +00:00
|
|
|
(def register-sub subs/register)
|
2015-02-25 11:03:02 +00:00
|
|
|
(def subscribe subs/subscribe)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(def pure middleware/pure)
|
2015-03-01 20:58:34 +00:00
|
|
|
(def debug middleware/debug)
|
2015-02-25 11:03:02 +00:00
|
|
|
(def undoable middleware/undoable)
|
|
|
|
(def path middleware/path)
|
|
|
|
(def validate middleware/validate)
|
2015-02-26 15:07:35 +00:00
|
|
|
(def trim-v middleware/trim-v)
|
2015-03-04 13:00:36 +00:00
|
|
|
(def after middleware/after)
|
2015-03-01 20:58:34 +00:00
|
|
|
; (def log-events middleware/log-events)
|
2015-02-25 11:03:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-02 14:03:09 +00:00
|
|
|
;; -- Convenience API -------
|
2015-02-25 11:03:02 +00:00
|
|
|
|
2015-03-02 14:03:09 +00:00
|
|
|
;; virtually every handler will be pure, ao make it easy
|
2015-02-25 11:03:02 +00:00
|
|
|
(defn register-pure-handler
|
|
|
|
([id handler]
|
|
|
|
(register-handler id pure handler))
|
|
|
|
([id middleware handler]
|
2015-02-26 15:07:35 +00:00
|
|
|
(register-handler id [pure middleware] handler)))
|
2015-03-02 12:02:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|