Partially fix #43 by adding ability to clear both kinds of handlers.

This commit is contained in:
mike-thompson-day8 2015-04-25 09:50:46 +10:00
parent 3cf565c8d4
commit c1fe51ddfd
3 changed files with 17 additions and 2 deletions

View File

@ -12,9 +12,12 @@
(def dispatch-sync router/dispatch-sync)
(def register-sub subs/register)
(def clear-sub-handlers! subs/clear-handlers!)
(def subscribe subs/subscribe)
(def clear-event-handlers! handlers/clear-handlers!)
(def pure middleware/pure)
(def debug middleware/debug)

View File

@ -33,6 +33,12 @@
(get @id->fn event-id))
(defn clear-handlers!
"Unregister all event handlers"
[]
(reset! id->fn {}))
(defn register-base
"register a handler for an event.
This is low level and it is expected that \"re-frame.core/register-handler\" would

View File

@ -9,6 +9,12 @@
(def ^:private key->fn (atom {}))
(defn clear-handlers!
"Unregister all subscription handlers"
[]
(reset! key->fn {}))
(defn register
"register a hander function for an id"
[key-v handler-fn]