Skip to content

Commit 2a4f406

Browse files
committed
Migrated TwitterBuzz to new prop acces synatx
1 parent 8b5b29e commit 2a4f406

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

samples/twitterbuzz/src/twitterbuzz/core.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
(defn search-tag
4646
"Get the current tag value from the page."
4747
[]
48-
(.value (dom/get-element :twitter-search-tag)))
48+
(.-value (dom/get-element :twitter-search-tag)))
4949

5050
(defn retrieve
5151
"Send request to twitter."
@@ -205,7 +205,7 @@
205205
(let [q (apply str (interpose " OR " (map #(str "from:" %)
206206
(take max-missing-query missing))))]
207207
(set-tweet-status :okay "Fetching mentioned tweets")
208-
(retrieve (.strobj {"q" q "rpp" results-per-page})
208+
(retrieve (.-strobj {"q" q "rpp" results-per-page})
209209
#(add-missing-callback missing %)
210210
error-callback)))
211211

@@ -214,7 +214,7 @@
214214
[]
215215
(when-let [tag (:search-tag @state)]
216216
(set-tweet-status :okay "Fetching tweets")
217-
(retrieve (.strobj {"q" tag "rpp" results-per-page})
217+
(retrieve (.-strobj {"q" tag "rpp" results-per-page})
218218
new-tweets-callback
219219
error-callback)))
220220

samples/twitterbuzz/src/twitterbuzz/dom-helpers.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
[tag & args]
5353
(let [[tag attrs children] (normalize-args tag args)
5454
parent (dom/createDom (name tag)
55-
(.strobj (reduce (fn [m [k v]]
55+
(.-strobj (reduce (fn [m [k v]]
5656
(assoc m k v))
5757
{}
5858
(map #(vector (name %1) %2)

samples/twitterbuzz/src/twitterbuzz/showgraph.cljs

+7-7
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@
7777

7878
; Draw mention edges
7979
(doseq [[username {ux1 :x, uy1 :y}] locs
80-
:let [x1 (unit-to-pixel ux1 (.width canvas-size))
81-
y1 (unit-to-pixel uy1 (.height canvas-size))]
80+
:let [x1 (unit-to-pixel ux1 (.-width canvas-size))
81+
y1 (unit-to-pixel uy1 (.-height canvas-size))]
8282
[mention-name mention-count] (:mentions (get mentions username))]
8383
(when-let [{ux2 :x, uy2 :y} (get locs mention-name)]
84-
(let [x2 (unit-to-pixel ux2 (.width canvas-size))
85-
y2 (unit-to-pixel uy2 (.height canvas-size))]
84+
(let [x2 (unit-to-pixel ux2 (.-width canvas-size))
85+
y2 (unit-to-pixel uy2 (.-height canvas-size))]
8686
(.drawPath g
8787
(-> (. g (createPath)) (.moveTo x1 y1) (.lineTo x2 y2))
8888
edge-stroke nil))))
8989

9090
; Draw avatar nodes
9191
(doseq [[username {:keys [x y] :as foo}] locs]
9292
;(log (pr-str foo))
93-
(let [px (- (unit-to-pixel x (.width canvas-size)) (/ avatar-size 2))
94-
py (- (unit-to-pixel y (.height canvas-size)) (/ avatar-size 2))
93+
(let [px (- (unit-to-pixel x (.-width canvas-size)) (/ avatar-size 2))
94+
py (- (unit-to-pixel y (.-height canvas-size)) (/ avatar-size 2))
9595
user (get mentions username)
9696
image-url (get user :image-url default-avatar)
9797
img (.drawImage g px py avatar-size avatar-size image-url)]
@@ -104,7 +104,7 @@
104104
"No locations to graph"
105105
text)]
106106
(when text
107-
(.drawTextOnLine g text 5 20 (.width canvas-size) 20
107+
(.drawTextOnLine g text 5 20 (.-width canvas-size) 20
108108
"left" font nil fill)))))
109109

110110
(def graph-data (atom nil))

0 commit comments

Comments
 (0)