Countdown timer component.
Usage: (def my-timer (timer :timeout 60000)) ; 60 seconds
;; In update function: (timer-update my-timer msg)
;; In view function: (timer-view my-timer)
Countdown timer component. Usage: (def my-timer (timer :timeout 60000)) ; 60 seconds ;; In update function: (timer-update my-timer msg) ;; In view function: (timer-view my-timer)
(for-timer? tmr msg)Check if a message is for this timer.
Check if a message is for this timer.
(interval tmr)Get tick interval in milliseconds.
Get tick interval in milliseconds.
(reset tmr initial-timeout)Reset timer to initial timeout, returns [timer cmd].
Reset timer to initial timeout, returns [timer cmd].
(set-interval tmr ms)Set the tick interval in milliseconds.
Set the tick interval in milliseconds.
(set-timeout tmr ms)Set the timeout in milliseconds.
Set the timeout in milliseconds.
(start tmr)Start the timer, returns [timer cmd].
Start the timer, returns [timer cmd].
(start-stop-msg timer-id running?)Create a start/stop message.
Create a start/stop message.
(tick-msg timer-id tag)Create a timer tick message.
Create a timer tick message.
(tick-msg? msg)Check if a message is a timer tick.
Check if a message is a timer tick.
(timed-out? tmr)Check if timer has timed out.
Check if timer has timed out.
(timeout tmr)Get remaining timeout in milliseconds.
Get remaining timeout in milliseconds.
(timeout-msg timer-id)Create a timer timeout message.
Create a timer timeout message.
(timeout-msg? msg)Check if a message is a timer timeout.
Check if a message is a timer timeout.
(timer &
{:keys [timeout interval running style id]
:or {timeout 0 interval 1000 running true id (rand-int 1000000)}})Create a timer component.
Options: :timeout - Time in milliseconds (default 0, counts up if 0) :interval - Tick interval in milliseconds (default 1000) :running - Start running (default true) :style - Style for timer display :id - Unique ID
Create a timer component. Options: :timeout - Time in milliseconds (default 0, counts up if 0) :interval - Tick interval in milliseconds (default 1000) :running - Start running (default true) :style - Style for timer display :id - Unique ID
(timer-init tmr)Initialize the timer, returns [timer cmd]. Call this to start the timer.
Initialize the timer, returns [timer cmd]. Call this to start the timer.
(timer-update tmr msg)Update timer state based on a message. Returns [new-timer cmd] or [timer nil] if message not handled.
Update timer state based on a message. Returns [new-timer cmd] or [timer nil] if message not handled.
(timer-view tmr)Render the timer to a string.
Render the timer to a string.
(toggle tmr)Toggle timer running state, returns [timer cmd].
Toggle timer running state, returns [timer cmd].
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 |