diff --git a/src/day8/re_frame/trace/macros.clj b/src/day8/re_frame/trace/macros.clj index b3b2542..c4a980a 100644 --- a/src/day8/re_frame/trace/macros.clj +++ b/src/day8/re_frame/trace/macros.clj @@ -5,3 +5,13 @@ "Reads a file as a string. Slurp is wrapped in a macro so it can interact with local files before clojurescript compilation." [path] (slurp (io/resource path))) + +(defmacro with-cljs-devtools-prefs [prefs & body] + `(let [previous-config# (devtools.prefs/get-prefs) + prefs# ~prefs] + (try + (devtools.prefs/set-prefs! prefs#) + ~@body + (finally + (assert (= (devtools.prefs/get-prefs) prefs#) "someone modified devtools.prefs behind our back!") + (devtools.prefs/set-prefs! previous-config#)))))