Created
November 6, 2014 08:46
-
-
Save blissdev/a9d58df627eb2877cb30 to your computer and use it in GitHub Desktop.
Revisions
-
blissdev created this gist
Nov 6, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ (defn subscribe-to-match [owner match-id] (let [pusher (om/get-shared owner :pusher) previous-channel (om/get-state owner :match-pusher-chan) new-channel (.subscribe pusher (str "match-" match-id)) events-chan (om/get-shared owner :match-events-chan) events-list ["draft_character" "begin" "update_score" "set_turn_number" "add_target" "remove_target" "change_round" "change_turn" "update_health"]] (when previous-channel (.unbind previous-channel)) (doseq [event-name events-list] (.bind new-channel event-name #(match-event % events-chan event-name))) (om/set-state! owner :match-pusher-chan new-channel)))