From e9a51c14b8e37aed870dfc9314af75f08c9b4c92 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 15 Mar 2016 20:52:29 +0200 Subject: [PATCH] Minor renames on rstore impl. --- src/uxbox/rstore.cljs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uxbox/rstore.cljs b/src/uxbox/rstore.cljs index 1ba49ac5f9..1ce928cf84 100644 --- a/src/uxbox/rstore.cljs +++ b/src/uxbox/rstore.cljs @@ -66,7 +66,7 @@ ([event & events] (run! #(rx/push! bus %) (into [event] events)))) -(defn swap-state +(defn swap "A helper for just apply some function to state without a need to declare additional event." [f] @@ -75,7 +75,7 @@ (-apply-update [_ state] (f state)))) -(defn reset-state +(defn reset "A event that resets the internal state with the provided value." [state] @@ -84,6 +84,8 @@ (-apply-update [_ _] state))) +(enable-console-print!) + (defn init "Initializes the stream event loop and return a stream with model changes." @@ -108,5 +110,5 @@ (rx/subscribe $ (fn [[event model]] (-apply-effect event model)))) ;; Initialize the stream machinary with initial state. - (emit! (swap-state (fn [s] (merge s state)))) + (emit! (swap #(merge % state))) state-s))