added ability to reload the bank balances automatically.
This commit is contained in:
@@ -259,3 +259,19 @@
|
||||
(dates->date-times)
|
||||
(on-success)
|
||||
(re-frame/dispatch))))))))
|
||||
|
||||
(defonce interval-handler
|
||||
(let [live-intervals (atom {})]
|
||||
(fn handler [{:keys [action id frequency event]}]
|
||||
(condp = action
|
||||
:clean (doall
|
||||
(map #(handler {:action :end :id %1}) (keys @live-intervals)))
|
||||
:start (swap! live-intervals assoc id (js/setInterval #(re-frame/dispatch event) frequency))
|
||||
:end (do (js/clearInterval (get @live-intervals id))
|
||||
(swap! live-intervals dissoc id))))))
|
||||
(interval-handler {:action :clean})
|
||||
(re-frame.core/reg-fx ;; the re-frame API for registering effect handlers
|
||||
:interval ;; the effect id
|
||||
interval-handler)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user