(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) ; has already passed, will be ignored. (.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
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) ; has already passed, will be ignored.
(.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 READMEcljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |