mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Every sends the time at which the timer ticked
This commit is contained in:
@@ -12,7 +12,11 @@ import (
|
||||
|
||||
type model int
|
||||
|
||||
type tickMsg struct{}
|
||||
type tickMsg time.Time
|
||||
|
||||
func newTickMsg(t time.Time) tea.Msg {
|
||||
return tickMsg(t)
|
||||
}
|
||||
|
||||
func main() {
|
||||
tea.AltScreen()
|
||||
@@ -55,7 +59,7 @@ func update(message tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
|
||||
|
||||
func subscriptions(_ tea.Model) tea.Subs {
|
||||
return tea.Subs{
|
||||
"tick": tea.Every(time.Second, tickMsg{}),
|
||||
"tick": tea.Every(time.Second, newTickMsg),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user