Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benzap committed Jun 7, 2018
1 parent 79526fd commit 8237015
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src-cljs/flyer/messaging.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@

(defn like-this-channel?
[msg-channel callback-channel]
(some true?
[(= callback-channel (default-message :channel))
(= msg-channel callback-channel)]))
(or (= callback-channel (default-message :channel))
(= msg-channel callback-channel)))


(defn like-this-topic?
Expand Down Expand Up @@ -97,13 +96,13 @@

(defn ^:export like-this-flyer?
"determines if the callback should be called based on the channel
and the topic"
and the topic"
[msg-topic msg-channel msg-origin
callback-topic callback-channel callback-origin]
(every? true?
[(like-this-channel? msg-channel callback-channel)
(like-this-topic? msg-topic callback-topic)
(like-this-origin? msg-origin callback-origin)]))
(and
(like-this-channel? msg-channel callback-channel)
(like-this-topic? msg-topic callback-topic)
(like-this-origin? msg-origin callback-origin)))


(defn ^:export subscribe
Expand Down Expand Up @@ -136,8 +135,8 @@ and the topic"
msg-channel (or (aget msg-js "channel") "FOREIGN")
msg-topic (or (aget msg-js "topic") (default-message :topic))
msg-data (or (aget msg-js "data") (default-message :data))
msg-origin (-> event .getBrowserEvent .-origin)
]
msg-origin (-> event .getBrowserEvent .-origin)]

(when (like-this-flyer? msg-topic msg-channel msg-origin topic channel origin)
(callback msg-data msg-topic msg-channel msg-origin))))]
(create-broadcast-listener js/window callback-wrapper)))

0 comments on commit 8237015

Please sign in to comment.