Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(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