🎉 Improved transformations

This commit is contained in:
alonso.torres 2020-04-22 13:35:53 +02:00
parent d050103f58
commit b73958efd0
21 changed files with 1257 additions and 1017 deletions

View file

@ -0,0 +1,37 @@
(ns uxbox.util.debug
"Debugging utils")
(def debug-options #{:bounding-boxes :group :events #_:simple-selection})
(defonce ^:dynamic *debug* (atom #{}))
(defn debug-all! [] (reset! *debug* debug-options))
(defn debug-none! [] (reset! *debug* #{}))
(defn debug! [option] (swap! *debug* conj option))
(defn -debug! [option] (swap! *debug* disj option))
(defn debug? [option] (@*debug* option))
(defn tap
"Transducer function that can execute a side-effect `effect-fn` per input"
[effect-fn]
(fn [rf]
(fn
([] (rf))
([result] (rf result))
([result input]
(effect-fn input)
(rf result input)))))
(defn logjs
([str] (tap (partial logjs str)))
([str val]
(js/console.log str (clj->js val))
val))
(defn dump-state []
(logjs "state" @uxbox.main.store/state))
(defn dump-objects []
(let [page-id (get @uxbox.main.store/state :page-id)]
(logjs "state" (get-in @uxbox.main.store/state [:workspace-data page-id :objects]))))