Create a gist now

Instantly share code, notes, and snippets.

Embed
(ns async-test.timeout.core
(:require [cljs.core.async :refer [chan close!]])
(:require-macros
[cljs.core.async.macros :as m :refer [go]]))
(defn timeout [ms]
(let [c (chan)]
(js/setTimeout (fn [] (close! c)) ms)
c))
(go
(<! (timeout 1000))
(.log js/console "Hello")
(<! (timeout 1000))
(.log js/console "async")
(<! (timeout 1000))
(.log js/console "world!"))
@JimTheMan

This comment has been minimized.

Show comment
Hide comment
@JimTheMan

JimTheMan Dec 3, 2017

love this one, but when I put it in klipse it just returns #object[cljs.core.async.impl.channels.ManyToManyChannel].

JimTheMan commented Dec 3, 2017

love this one, but when I put it in klipse it just returns #object[cljs.core.async.impl.channels.ManyToManyChannel].

@JimTheMan

This comment has been minimized.

Show comment
Hide comment
@JimTheMan

JimTheMan Dec 3, 2017

Ah, I see now it's using js/console so the text appears in the chrome dev tools console, not the klipse console.

JimTheMan commented Dec 3, 2017

Ah, I see now it's using js/console so the text appears in the chrome dev tools console, not the klipse console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment