Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active November 16, 2021 16:18
Show Gist options
  • Save swannodette/5882703 to your computer and use it in GitHub Desktop.
Save swannodette/5882703 to your computer and use it in GitHub Desktop.
(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

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