Skip to content

Commit

Permalink
re-implement figwheel.client.utils/feature? as a macro
Browse files Browse the repository at this point in the history
  • Loading branch information
milt committed Mar 2, 2018
1 parent ec725ce commit 96dd111
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 5 additions & 0 deletions support/src/figwheel/client/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@
(defmacro dev-assert [& body]
`(dev
~@(map (fn [pred-stmt] `(assert ~pred-stmt)) body)))

(defmacro feature?
[obj feature]
`(and (cljs.core/exists? ~obj)
(cljs.core/exists? (cljs.core/aget ~obj ~feature))))
9 changes: 2 additions & 7 deletions support/src/figwheel/client/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[goog.userAgent.product :as product])
(:import [goog]
[goog.async Deferred]
[goog.string StringBuffer]))
[goog.string StringBuffer])
(:require-macros [figwheel.client.utils :refer [feature?]]))

;; don't auto reload this file it will mess up the debug printing

Expand Down Expand Up @@ -110,12 +111,6 @@
deferred coll)
(fn [_] (.succeed Deferred @results)))))


(defn- feature? [obj feature]
(and (exists? obj)
(exists? (aget obj feature))))


;; persistent storage of configuration keys

(defonce local-persistent-config
Expand Down

0 comments on commit 96dd111

Please # to comment.