Liking cljdoc? Tell your friends :D Clojure Client

Clojars Project


This is the official Clojure client for It allows you to easily create new clocks and invoke actions on ticks.


Ticktok artifacts are released to Clojars.

[ticktok "1.0.8"]
compile 'ticktok:ticktok:1.0.8'

Quick Start

Ticktok assumes default configuration when not provided, as documented in Ticktok docs.

Register an action for a clock

(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 ""
                              :schedule "every.1.hours"
                              :callback #(println "Second clock got a tick!")})

(tk/ticktok :close)

In the example above we registred two clocks in different supported ways:

  • By calling (ticktok :start config) - returns us a function that waits to schedule clocks associated to the given config.
  • By calling (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 :close.

Replace callback of a given clock

It's now (1.0.6+) possible to swap callback for a registered clock. When calling (ticktok :schedule) with the same clock but with different callback, ticktok swaps the consuming callback:

(require '[ticktok.core :as tk])

(tk/ticktok :schedule {:name "hurry.up"
                      :schedule "every.3.seconds"
                      :callback #(println "First callback invoked!")})

(tk/ticktok :schedule {:name "hurry.up"
                      :schedule "every.3.seconds"
                      :callback #(println "Second callback invoked!")})


Have some questions or ideas? chat with us on Slack

Can you improve this documentation? These fine people already did:
wanishing, Asaf Chelouche & Eli Segal
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close