Skip to content

Commit

Permalink
Indentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lnostdal committed Apr 30, 2016
1 parent b58ccec commit c5ef3fe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions src/symbolicweb/util.clj
Expand Up @@ -142,9 +142,9 @@ Appends a timestamp to the URL based on file mtime."
(float-to-string x decimal-format java.math.RoundingMode/DOWN))

([x ^String decimal-format rounding-mode]
(if-let [v (or (and (float? x) x)
(and (ratio? x) (double x)))]
(.format (with1 (java.text.DecimalFormat. decimal-format)
(.setRoundingMode it rounding-mode))
v)
x)))
(if-let [v (or (and (float? x) x)
(and (ratio? x) (double x)))]
(.format (with1 (java.text.DecimalFormat. decimal-format)
(.setRoundingMode it rounding-mode))
v)
x)))
44 changes: 22 additions & 22 deletions src/symbolicweb/value_model.clj
Expand Up @@ -88,14 +88,14 @@ as the first argument to CALLBACK."

(defn vm
(^ValueModel [value]
(vm value =))
(vm value =))

(^ValueModel [value ^Fn cmp-fn]
(ValueModel. (ref value)
(mk-Observable (fn [^Observable observable old-value new-value]
(when-not (cmp-fn old-value new-value)
(doseq [^Fn observer-fn (ensure (.observers observable))]
(observer-fn old-value new-value))))))))
(ValueModel. (ref value)
(mk-Observable (fn [^Observable observable old-value new-value]
(when-not (cmp-fn old-value new-value)
(doseq [^Fn observer-fn (ensure (.observers observable))]
(observer-fn old-value new-value))))))))



Expand All @@ -121,32 +121,32 @@ See VM-SYNC if you need a copy that is synced with the original VALUE-MODEL."
LIFETIME: The lifetime of this connection is governed by LIFETIME and can be an instance of Lifetime or NIL for 'infinite'
lifetime (as long as VALUE-MODEL exists)."
([^ValueModel value-model lifetime ^Fn callback]
(vm-sync value-model lifetime callback true))
(vm-sync value-model lifetime callback true))

([^ValueModel value-model lifetime ^Fn callback ^Boolean initial-sync?]
(let [^ValueModel mid (vm nil)]
(vm-observe value-model lifetime initial-sync?
#(vm-set mid (apply callback %&)))
mid)))
(let [^ValueModel mid (vm nil)]
(vm-observe value-model lifetime initial-sync?
#(vm-set mid (apply callback %&)))
mid)))



(defn ^ValueModel vm-syncs
" CALLBACK takes no arguments."
([value-models lifetime ^Fn callback]
(vm-syncs value-models lifetime callback true))
(vm-syncs value-models lifetime callback true))

([value-models lifetime ^Fn callback ^Boolean initial-sync?]
(let [^ValueModel mid (vm nil)
^Atom already-synced? (atom false)] ;; We only want to trigger an initial sync once if at all.
(doseq [^ValueModel value-model value-models]
(vm-observe value-model lifetime (if (and initial-sync? (not @already-synced?))
(do
(reset! already-synced? true)
true)
false)
(fn [& _] (vm-set mid (callback)))))
mid)))
(let [^ValueModel mid (vm nil)
^Atom already-synced? (atom false)] ;; We only want to trigger an initial sync once if at all.
(doseq [^ValueModel value-model value-models]
(vm-observe value-model lifetime (if (and initial-sync? (not @already-synced?))
(do
(reset! already-synced? true)
true)
false)
(fn [& _] (vm-set mid (callback)))))
mid)))



Expand Down

0 comments on commit c5ef3fe

Please sign in to comment.