Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
async timeout lag
;; copy and paste this code into cljsfiddle.com (or your local cljs environment)
(ns cljsfiddle
(:require [cljs.core.async :as async
:refer [<! >! put! chan timeout close!]])
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
(defn print-time! [s]
(print (str s ": " (.getTime (js/Date.)))))
(let [ch (chan)]
(go (while true
(<! (timeout 1000))
(>! ch "")
(print-time! "sent")))
(go (while true
(<! ch)
(print-time! "recv"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.