-
-
Save knubie/a031b3db6ad7afb25d91732b3bc76a4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defonce FREQUENCY-MS (* 1000 10)) | |
(def today (r/atom (time/today))) | |
(re-frame/reg-sub-raw :time/today | |
;; See https://github.com/Day8/re-frame/blob/master/docs/SubscriptionFlow.md | |
;; for information on how to use reg-sub-raw. | |
(fn [app-db _] | |
(let [interval (js/setInterval #(reset! today (time/today)) FREQUENCY-MS)] | |
(ratom/make-reaction | |
#(deref today) | |
:on-dispose #(js/clearInterval interval))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment