update docs

This commit is contained in:
2026-01-23 07:56:25 -05:00
parent 8c7cb24171
commit a3c01d4b5a
5 changed files with 37 additions and 36 deletions
+8 -7
View File
@@ -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