Skip to content

Instantly share code, notes, and snippets.

@mullr
Created December 31, 2013 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mullr/8191555 to your computer and use it in GitHub Desktop.
Save mullr/8191555 to your computer and use it in GitHub Desktop.
;;; Event loop
(def ^:dynamic *ui-events-chan* (chan))
(defn post-event [type cursor param]
(let [path (.-path cursor)]
(put! *ui-events-chan* [type path param])))
(declare handle-event)
(defn run-event-loop [root-cursor]
(go-loop []
(om/update! root-cursor handle-event (<! *ui-events-chan*))
(recur)))
(defn handle-event [app [type path param :as e]]
(case type
; ...
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment