Skip to content

Commit 2d1fbc5

Browse files
committed
formatting
1 parent 4e41698 commit 2d1fbc5

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

clients/cljs-om/src/cljs_om/core.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
(def prev-tweets-chan (chan 10000))
4040

4141
(go-loop []
42-
(let [[t chan] (alts! [tweets-chan prev-tweets-chan] :priority)]
42+
(let [[t chan] (alts! [tweets-chan prev-tweets-chan] :priority true)]
4343
(tweets/add-tweet t app-state word-cloud)
4444
(recur)))
4545

clients/cljs-om/src/cljs_om/tweets.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
(defn add-to-tweets-map [app tweets-map tweet]
1212
"adds tweet to tweets-map"
13-
(swap! app assoc-in [tweets-map (keyword (:id_str tweet))] (util/format-tweet tweet)))
13+
(swap! app
14+
assoc-in [tweets-map (keyword (:id_str tweet))]
15+
(util/format-tweet tweet)))
1416

1517
(defn swap-when-larger [app priority-map rt-id n]
1618
"swaps item in priority-map when new value is larger than old value"

clients/cljs-om/src/cljs_om/util.cljs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"formats a number for display, e.g. 1.7K, 122K or 1.5M followers"
1010
(cond
1111
(< number 1000) (str number)
12-
(< number 100000) (str (/ (.round js/Math (/ number 100))10) "K")
12+
(< number 100000) (str (/ (.round js/Math (/ number 100)) 10) "K")
1313
(< number 1000000) (str (.round js/Math (/ number 1000)) "K")
1414
:default (str (/ (.round js/Math (/ number 100000)) 10) "M")))
1515

@@ -69,16 +69,18 @@
6969
"swaps item in priority-map"
7070
(swap! app assoc priority-map (assoc (priority-map @app) id n)))
7171

72-
(defn initial-state [] {:count 0 :n 10 :retweets {}
73-
:tweets-map {} :search-text "" :page 1
74-
:search "*" :stream nil
75-
:sorted :by-rt-since-startup
76-
:by-followers (priority-map-by >)
77-
:by-retweets (priority-map-by >)
78-
:by-favorites (priority-map-by >)
79-
:by-rt-since-startup (priority-map-by >)
80-
:by-id (priority-map-by >)
81-
:words-sorted-by-count (priority-map-by >)})
72+
(defn initial-state []
73+
"function returning fresh application state"
74+
{:count 0 :n 10 :retweets {}
75+
:tweets-map {} :search-text "" :page 1
76+
:search "*" :stream nil
77+
:sorted :by-rt-since-startup
78+
:by-followers (priority-map-by >)
79+
:by-retweets (priority-map-by >)
80+
:by-favorites (priority-map-by >)
81+
:by-rt-since-startup (priority-map-by >)
82+
:by-id (priority-map-by >)
83+
:words-sorted-by-count (priority-map-by >)})
8284

8385
(defn tweets-by-order [tweets-map order]
8486
"find top n tweets by specified order"

0 commit comments

Comments
 (0)