(add-effect! ticker k f)Registers an effect function f under key k to be regularly executed by the ticker.
ticker: The ticker instance returned by ticker.k: A unique key for the effect.f: A zero-argument function to be executed.Registers an effect function `f` under key `k` to be regularly executed by the ticker. - `ticker`: The ticker instance returned by `ticker`. - `k`: A unique key for the effect. - `f`: A zero-argument function to be executed.
(remove-effect! ticker k)Removes the effect function associated with key k from the ticker.
ticker: The ticker instance.k: The effect key to remove.Removes the effect function associated with key `k` from the ticker. - `ticker`: The ticker instance. - `k`: The effect key to remove.
(ticker {:keys [interval] :or {interval (* 15 60 1000)}})Creates a ticker component that runs registered effects at a regular interval (in ms). Options:
:interval (default 15 minutes): interval in milliseconds between executions.
Returns a component that implements com/start and com/stop and holds effect functions under ::effects.
Usage:
(def t (com/start (ticker {:interval 1000})))
(add-effect! t ::foo #(prn :yolo))
(com/stop t)Creates a ticker component that runs registered effects at a regular interval (in ms).
Options:
- `:interval` (default 15 minutes): interval in milliseconds between executions.
Returns a component that implements `com/start` and `com/stop` and holds effect functions under `::effects`.
Usage:
(def t (com/start (ticker {:interval 1000})))
(add-effect! t ::foo #(prn :yolo))
(com/stop t)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |