How to debounce a model change? #601
-
I’d like to debounce a func call after a key stroke. I found a tea.Tick, but I need update the model instantly. And clear some model field after one sec. Is it safe to modify a model from a goruthine? |
Beta Was this translation helpful? Give feedback.
Answered by
meowgorithm
Nov 15, 2022
Replies: 1 comment 3 replies
-
There’s actually a simple pattern for this which is probably best explained with an example: https://github.com/charmbracelet/bubbletea/blob/master/examples/debounce/main.go But do let us know if you have more questions, too. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
antonmedv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There’s actually a simple pattern for this which is probably best explained with an example:
https://github.com/charmbracelet/bubbletea/blob/master/examples/debounce/main.go
But do let us know if you have more questions, too.