Skip to content

Instantly share code, notes, and snippets.

@jaycfields
Created February 23, 2013 21:21
Show Gist options
  • Save jaycfields/5021379 to your computer and use it in GitHub Desktop.
Save jaycfields/5021379 to your computer and use it in GitHub Desktop.
;; 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