Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Lightweight logging of db state changes for reagent/re-frame
(defn watch-db []
(add-watch re-frame.db/app-db :watcher
(fn [_ _ old-state new-state]
(let [[removed added] ( old-state new-state)]
(when (or removed added)
(println "=====\nRemoved:")
(cljs.pprint/pprint removed)
(println "Added:")
(cljs.pprint/pprint added))))))
(defn unwatch-db []
(remove-watch re-frame.db/app-db :watcher))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.