Back

chime-ch (clj)

(source)

function

(chime-ch times & [{:keys [ch], :or {ch (a/chan)}}])
Deprecated: use `chime.core-async/chime-ch` - see the source of this fn for a migration. Returns a core.async channel that 'chimes' at every time in the times list. Times that have already passed are ignored. 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

Examples