Back
chime-ch (clj)
(source)function
(chime-ch times & [{:keys [ch], :or {ch (a/chan)}}])
Returns a core.async channel that 'chimes' at every time in the times list.
Arguments:
times - (required) Sequence of java.util.Dates, java.time.Instant,
java.time.ZonedDateTime or msecs since epoch
ch - (optional) Channel to chime on - defaults to a new unbuffered channel
Closing this channel stops the schedule.
Usage:
(let [chimes (chime-ch [(.plusSeconds (Instant/now) -2)
(.plusSeconds (Instant/now) 2)
(.plusSeconds (Instant/now) 2)])]
(a/<!! (go-loop []
(when-let [msg (<! chimes)]
(prn "Chiming at:" msg)
(recur)))))
There are extensive usage examples in the README