update docs
This commit is contained in:
@@ -70,18 +70,19 @@ Constant value returned as a command to exit the application.
|
||||
[model nil]))
|
||||
```
|
||||
|
||||
### tick
|
||||
### after
|
||||
|
||||
```clojure
|
||||
(tick ms)
|
||||
(after ms msg)
|
||||
```
|
||||
|
||||
Create a command that sends `:tick` message after a delay.
|
||||
Create a command that sends `msg` after a delay.
|
||||
|
||||
**Parameters:**
|
||||
- `ms` - Delay in milliseconds
|
||||
- `msg` - Message to send after the delay
|
||||
|
||||
**Returns:** A tick command
|
||||
**Returns:** An async command
|
||||
|
||||
**Example:**
|
||||
|
||||
@@ -89,14 +90,14 @@ Create a command that sends `:tick` message after a delay.
|
||||
;; Start a 1-second timer
|
||||
(defn update-fn [model msg]
|
||||
(case msg
|
||||
:tick [(update model :seconds inc) (tui/tick 1000)]
|
||||
:timer-tick [(update model :seconds inc) (tui/after 1000 :timer-tick)]
|
||||
[model nil]))
|
||||
|
||||
;; Initial tick
|
||||
;; Initial timer
|
||||
(tui/run {:init {:seconds 0}
|
||||
:update update-fn
|
||||
:view view
|
||||
:init-cmd (tui/tick 1000)})
|
||||
:init-cmd (tui/after 1000 :timer-tick)})
|
||||
```
|
||||
|
||||
### batch
|
||||
|
||||
Reference in New Issue
Block a user