Skip to content

Commit

Permalink
Merge pull request #51 from ducky427/master
Browse files Browse the repository at this point in the history
Set goog.DEBUG and only check schema in development
  • Loading branch information
drapanjanas committed May 14, 2016
2 parents 20296f0 + a2bd81b commit 9a3123f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions resources/cljs-reagent/handlers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
(defn check-and-throw
"throw an exception if db doesn't match the schema."
[a-schema db]
(if-let [problems (s/check a-schema db)]
(when-let [problems (s/check a-schema db)]
(throw (js/Error. (str "schema check failed: " problems)))))

(def validate-schema-mw
(after (partial check-and-throw schema)))
(if goog.DEBUG
(after (partial check-and-throw schema))
[]))

;; -- Handlers --------------------------------------------------------------

Expand Down
6 changes: 4 additions & 2 deletions resources/cljs-reagent6/handlers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
(defn check-and-throw
"throw an exception if db doesn't match the schema."
[a-schema db]
(if-let [problems (s/check a-schema db)]
(when-let [problems (s/check a-schema db)]
(throw (js/Error. (str "schema check failed: " problems)))))

(def validate-schema-mw
(after (partial check-and-throw schema)))
(if goog.DEBUG
(after (partial check-and-throw schema))
[]))

;; -- Handlers --------------------------------------------------------------

Expand Down
6 changes: 4 additions & 2 deletions resources/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@
:output-dir "target/ios"
:static-fns true
:optimize-constants true
:optimizations :simple}}
:optimizations :simple
:closure-defines {"goog.DEBUG" false}}}
:android {:source-paths ["src" "env/prod"]
:compiler {:output-to "index.android.js"
:main "env.android.main"
:output-dir "target/android"
:static-fns true
:optimize-constants true
:optimizations :simple}}}}
:optimizations :simple
:closure-defines {"goog.DEBUG" false}}}}}
}})

0 comments on commit 9a3123f

Please sign in to comment.