0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-27 00:49:28 -05:00

Minor renames on rstore impl.

This commit is contained in:
Andrey Antukh 2016-03-15 20:52:29 +02:00
parent abd68ad2e9
commit e9a51c14b8

View file

@ -66,7 +66,7 @@
([event & events] ([event & events]
(run! #(rx/push! bus %) (into [event] events)))) (run! #(rx/push! bus %) (into [event] events))))
(defn swap-state (defn swap
"A helper for just apply some function to state "A helper for just apply some function to state
without a need to declare additional event." without a need to declare additional event."
[f] [f]
@ -75,7 +75,7 @@
(-apply-update [_ state] (-apply-update [_ state]
(f state)))) (f state))))
(defn reset-state (defn reset
"A event that resets the internal state with "A event that resets the internal state with
the provided value." the provided value."
[state] [state]
@ -84,6 +84,8 @@
(-apply-update [_ _] (-apply-update [_ _]
state))) state)))
(enable-console-print!)
(defn init (defn init
"Initializes the stream event loop and "Initializes the stream event loop and
return a stream with model changes." return a stream with model changes."
@ -108,5 +110,5 @@
(rx/subscribe $ (fn [[event model]] (-apply-effect event model)))) (rx/subscribe $ (fn [[event model]] (-apply-effect event model))))
;; Initialize the stream machinary with initial state. ;; Initialize the stream machinary with initial state.
(emit! (swap-state (fn [s] (merge s state)))) (emit! (swap #(merge % state)))
state-s)) state-s))