make textview1 example sleep when inactive

pull/319/head
ajcarvajal 5 years ago
parent 2e907d29e4
commit 49350e374a

@ -45,9 +45,13 @@ func TextView1(nextSlide func()) (title string, content tview.Primitive) {
go func() {
var n int
for {
n++
fmt.Fprintf(textView, "%d ", n)
time.Sleep(200 * time.Millisecond)
if textView.HasFocus() {
n++
fmt.Fprintf(textView, "%d ", n)
time.Sleep(200 * time.Millisecond)
} else {
time.Sleep(time.Second)
}
}
}()
textView.SetBorder(true).SetTitle("TextView implements io.Writer")

Loading…
Cancel
Save