2019-01-14 16:20:48 +00:00
|
|
|
(ns john-titor.utils
|
|
|
|
(:require
|
2019-03-19 21:06:04 +00:00
|
|
|
["bluebird" :as Promise]
|
|
|
|
[clojure.core.async :refer [take!]]))
|
2019-01-14 16:20:48 +00:00
|
|
|
|
2019-03-19 21:06:04 +00:00
|
|
|
(defn wait-for
|
2019-01-14 16:20:48 +00:00
|
|
|
[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)))))))
|