FG42/john_titor/src/john_titor/utils.cljs

13 lines
269 B
Plaintext
Raw Normal View History

(ns john-titor.utils
(:require
2019-03-19 21:06:04 +00:00
["bluebird" :as Promise]
[clojure.core.async :refer [take!]]))
2019-03-19 21:06:04 +00:00
(defn wait-for
[ch]
2019-03-19 21:06:04 +00:00
(Promise.
(fn [resolve]
;; Handle the channel timeout here
(take! ch (fn [value]
(resolve (clj->js value)))))))