Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active November 16, 2021 16:18
  • Star 29 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
(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!"))
@JimLynchCodes
Copy link

JimLynchCodes commented Dec 3, 2017

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

@JimLynchCodes
Copy link

JimLynchCodes 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