mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
stop widget's scheduler if the widget disabled after live-reloading
This commit is contained in:
parent
9dbf5065f2
commit
af98a750f1
@ -9,7 +9,7 @@ type Scheduler interface {
|
|||||||
RefreshInterval() int
|
RefreshInterval() int
|
||||||
}
|
}
|
||||||
|
|
||||||
func Schedule(widget Scheduler) {
|
func Schedule(widget Wtfable) {
|
||||||
// Kick off the first refresh and then leave the rest to the timer
|
// Kick off the first refresh and then leave the rest to the timer
|
||||||
widget.Refresh()
|
widget.Refresh()
|
||||||
|
|
||||||
@ -25,7 +25,12 @@ func Schedule(widget Scheduler) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-tick.C:
|
case <-tick.C:
|
||||||
widget.Refresh()
|
if widget.Enabled() {
|
||||||
|
widget.Refresh()
|
||||||
|
} else {
|
||||||
|
tick.Stop()
|
||||||
|
return
|
||||||
|
}
|
||||||
case <-quit:
|
case <-quit:
|
||||||
tick.Stop()
|
tick.Stop()
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user