This is a Clojure client for Ticktok.io. It allows you to easily creating new clocks and invoke actions on ticks.
Ticktok artifacts are released to Clojars.
[org.clojars.ticktok/ticktok "0.1.0"]
<dependency>
<groupId>org.clojars.ticktok</groupId>
<artifactId>ticktok</artifactId>
<version>0.1.0</version>
</dependency>
compile 'org.clojars.ticktok:ticktok:0.1.0'
Ticktok assumes default configuration when not provided, as documented in Ticktok docs.
(require '[ticktok.core :as tk])
(def config {:host "http://localhost:8080"
:token "ticktok-zY3wpR"})
(def ticktok (tk/ticktok :start config))
(ticktok :schedule {:name "hurry.up"
:schedule "every.3.seconds"
:callback #(println "First clock got a tick!")})
(tk/ticktok :schedule config {:name "ease.in"
:schedule "every.1.hours"
:callback #(println "Second clock got a tick!")})
(ticktok :stop)
In the example above we registred two clocks in different supported ways: the first one is by calling (ticktok :start config)
which returns us a function the waits to schedule clocks associated to the given config
. For the second clock, we call directly to (ticktok :schedule config clock)
with both the clock and the desired configuration. Behind the scenes, both ways are effectively the same.
To stop listening for new ticks, call ticktok with :stop
.
Have some questions/ideas? chat with us on Slack
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close