Skip to content

Instantly share code, notes, and snippets.

@fivetanley
Forked from swannodette/radical.cljs
Created June 28, 2013 04:15
Show Gist options
  • Save fivetanley/5882419 to your computer and use it in GitHub Desktop.
Save fivetanley/5882419 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 1))
(def loc-div (.getElementById js/document "location"))
(.addEventListener js/window "mousemove"
(fn [e]
(go
(>! c [(.-x e) (.-y e)]))))
(go
(loop []
(let [loc (<! c)]
(aset loc-div "innerHTML" (string/join ", " loc))
(recur))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment