Liking cljdoc? Tell your friends :D

charm.components.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)

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)
raw docstring

for-timer?clj

(for-timer? tmr msg)

Check if a message is for this timer.

Check if a message is for this timer.
sourceraw docstring

intervalclj

(interval tmr)

Get tick interval in milliseconds.

Get tick interval in milliseconds.
sourceraw docstring

resetclj

(reset tmr initial-timeout)

Reset timer to initial timeout, returns [timer cmd].

Reset timer to initial timeout, returns [timer cmd].
sourceraw docstring

running?clj

(running? tmr)

Check if timer is running.

Check if timer is running.
sourceraw docstring

set-intervalclj

(set-interval tmr ms)

Set the tick interval in milliseconds.

Set the tick interval in milliseconds.
sourceraw docstring

set-timeoutclj

(set-timeout tmr ms)

Set the timeout in milliseconds.

Set the timeout in milliseconds.
sourceraw docstring

startclj

(start tmr)

Start the timer, returns [timer cmd].

Start the timer, returns [timer cmd].
sourceraw docstring

start-stop-msgclj

(start-stop-msg timer-id running?)

Create a start/stop message.

Create a start/stop message.
sourceraw docstring

stopclj

(stop tmr)

Stop the timer.

Stop the timer.
sourceraw docstring

tick-msgclj

(tick-msg timer-id tag)

Create a timer tick message.

Create a timer tick message.
sourceraw docstring

tick-msg?clj

(tick-msg? msg)

Check if a message is a timer tick.

Check if a message is a timer tick.
sourceraw docstring

timed-out?clj

(timed-out? tmr)

Check if timer has timed out.

Check if timer has timed out.
sourceraw docstring

timeoutclj

(timeout tmr)

Get remaining timeout in milliseconds.

Get remaining timeout in milliseconds.
sourceraw docstring

timeout-msgclj

(timeout-msg timer-id)

Create a timer timeout message.

Create a timer timeout message.
sourceraw docstring

timeout-msg?clj

(timeout-msg? msg)

Check if a message is a timer timeout.

Check if a message is a timer timeout.
sourceraw docstring

timerclj

(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
sourceraw docstring

timer-initclj

(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.
sourceraw docstring

timer-updateclj

(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.
sourceraw docstring

timer-viewclj

(timer-view tmr)

Render the timer to a string.

Render the timer to a string.
sourceraw docstring

toggleclj

(toggle tmr)

Toggle timer running state, returns [timer cmd].

Toggle timer running state, returns [timer cmd].
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close