(chime-at times
f
&
[{:keys [error-handler on-finished] :or {on-finished (fn* [] ())}}])
(chime-ch times & [{:keys [ch] :or {ch (a/chan)}}])
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, org.joda.time.DateTimes 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 [(-> 2 t/seconds t/ago) ; has already passed, will be ignored. (-> 2 t/seconds t/from-now) (-> 3 t/seconds t/from-now)])] (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. Times that have already passed are ignored. Arguments: times - (required) Sequence of java.util.Dates, org.joda.time.DateTimes 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 [(-> 2 t/seconds t/ago) ; has already passed, will be ignored. (-> 2 t/seconds t/from-now) (-> 3 t/seconds t/from-now)])] (a/<!! (go-loop [] (when-let [msg (<! chimes)] (prn "Chiming at:" msg) (recur))))) There are extensive usage examples in the README
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close