Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active December 19, 2015 02:19

Revisions

  1. swannodette revised this gist Jun 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion radical.cljs
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    (:require-macros
    [cljs.core.async.macros :as m :refer [go alt! alts!]]))

    (def c (chan 1))
    (def c (chan))
    (def loc-div (.getElementById js/document "location"))

    (.addEventListener js/window "mousemove"
  2. swannodette revised this gist Jun 28, 2013. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions radical.cljs
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,6 @@
    (>! c [(.-x e) (.-y e)]))))

    (go
    (loop []
    (while true
    (let [loc (<! c)]
    (aset loc-div "innerHTML" (string/join ", " loc))
    (recur))))
    (aset loc-div "innerHTML" (string/join ", " loc)))))
  3. swannodette revised this gist Jun 28, 2013. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions radical.cljs
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    (ns async-test.core
    (:require [cljs.core.async :refer [chan]])
    (:require [cljs.core.async :refer [chan]]
    [clojure.string :as string])
    (:require-macros
    [cljs.core.async.macros :as m :refer [go alt! alts!]]))

    @@ -14,5 +15,5 @@
    (go
    (loop []
    (let [loc (<! c)]
    (aset loc-div "innerHTML" (apply str (interleave loc ", ")))
    (recur))))
    (aset loc-div "innerHTML" (string/join ", " loc))
    (recur))))
  4. swannodette created this gist Jun 28, 2013.
    18 changes: 18 additions & 0 deletions radical.cljs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    (ns async-test.core
    (:require [cljs.core.async :refer [chan]])
    (: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" (apply str (interleave loc ", ")))
    (recur))))