Skip to content

Instantly share code, notes, and snippets.

@fgui
Last active August 29, 2015 14:25
Show Gist options
  • Save fgui/eb7b15d1e70947105b81 to your computer and use it in GitHub Desktop.
Save fgui/eb7b15d1e70947105b81 to your computer and use it in GitHub Desktop.
clojurescript core.async
;; listen to event in javascript dom
;; https://swannodette.github.io/2013/11/07/clojurescript-101/
(defn listen [el type]
(let [out (chan)]
(events/listen el type
(fn [e] (put! out e)))
out))
(def clicks (listen (dom/getElement "search1") "click"))
(def keys-pressed (listen (dom/getElement "search1") "keypress"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment