From 9f2f87ebe65e5bbcd0781712489f407df5851826 Mon Sep 17 00:00:00 2001 From: Sam Hedin Date: Fri, 3 May 2024 14:12:41 +0200 Subject: [PATCH] Add once-per-second example to README (#59) --- README.adoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.adoc b/README.adoc index 38d15a5..68c9008 100644 --- a/README.adoc +++ b/README.adoc @@ -94,6 +94,15 @@ To generate the sequence of times, you'll need to seed the call to `periodic-seq (Period/ofDays 1)) ---- +For example, to say hello once per second: +[source,clojure] +---- +(chime/chime-at (chime/periodic-seq (Instant/now) (Duration/ofSeconds 1)) + ;; note that the function needs to take an argument. + (fn [time] + (println "hello"))) +---- + === Complex schedules Because there is no scheduling DSL included with Chime, the sorts of schedules that you can achieve are not limited to the scope of the DSL.