Skip to content

Instantly share code, notes, and snippets.

@mathieulegrand
Last active August 29, 2015 14:20
Show Gist options
  • Save mathieulegrand/1ea5fbf9d53a972b28f7 to your computer and use it in GitHub Desktop.
Save mathieulegrand/1ea5fbf9d53a972b28f7 to your computer and use it in GitHub Desktop.
om/IWillMount
(will-mount [_]
(go-loop []
(async/<! wait-for-channel-event)
(log (str "Atom first is " (:date (apply min-key :date (:content (deref data))))))
(let [new-from-server (async/<! (fetch-from-server url (:id (apply min-key :date (:content (deref data))))))]
(log (str "Server first is " (:date (apply min-key :date new-from-server))))
(om/transact! data :content #(apply conj % new-from-server))
(recur)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment