Skip to content

Instantly share code, notes, and snippets.

@ddeaguiar
Last active December 31, 2015 23:28
Show Gist options
  • Save ddeaguiar/8059877 to your computer and use it in GitHub Desktop.
Save ddeaguiar/8059877 to your computer and use it in GitHub Desktop.
(defn listen [el type]
(let [out (chan)]
(events/listen el type
(fn [e] (put! out e)))
out))
...
...
(defn init []
(let [clicks (listen (dom/getElement "search") "click")
results-view (dom/getElement "results")]
(go (while true
(<! clicks)
(let [[_ results] (<! (jsonp (query-url (user-query))))]
(set! (.-innerHTML results-view) (render-query results)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment