Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active December 19, 2015 02:19
Show Gist options
  • Save swannodette/5882323 to your computer and use it in GitHub Desktop.
Save swannodette/5882323 to your computer and use it in GitHub Desktop.
(ns async-test.core
(:require [cljs.core.async :refer [chan]]
[clojure.string :as string])
(:require-macros
[cljs.core.async.macros :as m :refer [go alt! alts!]]))
(def c (chan))
(def loc-div (.getElementById js/document "location"))
(.addEventListener js/window "mousemove"
(fn [e]
(go
(>! c [(.-x e) (.-y e)]))))
(go
(while true
(let [loc (<! c)]
(aset loc-div "innerHTML" (string/join ", " loc)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment