Last active
August 29, 2015 14:25
-
-
Save fgui/eb7b15d1e70947105b81 to your computer and use it in GitHub Desktop.
clojurescript core.async
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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