Created
February 23, 2013 21:21
-
-
Save jaycfields/5021379 to your computer and use it in GitHub Desktop.
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 characters
;; client | |
(defonce client-list (atom nil)) | |
(defn handle-update [{:keys [type val]}] | |
(if (= type :snapshot) | |
(reset! client-list val) | |
(when @client-list | |
(when (< 9 (count @client-list)) | |
(swap! client-list butlast)) | |
(swap! client-list conj val)))) | |
(defn client-start [] | |
(subscribe handle-update) | |
(get-snapshot)) | |
(defn client-stop [] | |
(subscribe identity)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment