const result = await Promise.race([promise1, promise2])
(go (let [[result chan] ;; result the value and while chan won
(<! (alts! [chan1
[value chan2] ;; even can wait a value >! chan
]))]
#_(doSomething)))
const [ result1, result2 ] = await Promise.all([promise1, promise2])
(go (let [res ;; first (+ chan1-result chan2-result) result
(<! (async/map
(fn [chan1-result chan2-result]
;; wait two channel all emitted value
;; once one channel closed, the result channel also be closed
(+ chan1-result chan2-result))
[chan1 chan2]))]
#_(doSomething)))
(go (let [records (<! (async/into [] chan))]
;; records is the all result of chan
(assert (vector? records))
#_(doSomething))