Skip to content

Instantly share code, notes, and snippets.

View maravillas's full-sized avatar

Matthew Maravillas maravillas

  • Eleos Technologies
  • Raleigh, NC
View GitHub Profile
;; based on http://talks.golang.org/2012/concurrency.slide#50
(ns robpike
(:require [cljs.core.async :as async :refer [<! >! chan close!]])
(:require-macros [cljs.core.async.macros :as m :refer [go alt!]]))
(defn timeout [ms]
(let [c (chan)]
(js/setTimeout (fn [] (close! c)) ms)
c))