Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created September 21, 2013 23:11
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 mattdeboard/c887905c0ee5b095bb70 to your computer and use it in GitHub Desktop.
Save mattdeboard/c887905c0ee5b095bb70 to your computer and use it in GitHub Desktop.
(def speed-chan (chan))
(defn speedometer []
(go
(while true
(.log js/console (<! speed-chan)))))
(defn adjust-speed [event]
(let [code (.-keyCode event)]
(go
(case code
37 (>! speed-chan -1)
39 (>! speed-chan 1)
nil))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment