mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Ensure the origin refresh() always kicks off, even for 0-interval widgets.
This commit is contained in:
parent
d982ca48c5
commit
90ab57e1b2
@ -10,6 +10,9 @@ type Scheduler interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Schedule(widget Scheduler) {
|
func Schedule(widget Scheduler) {
|
||||||
|
// Kick off the first refresh and then leave the rest to the timer
|
||||||
|
widget.Refresh()
|
||||||
|
|
||||||
interval := time.Duration(widget.RefreshInterval()) * time.Second
|
interval := time.Duration(widget.RefreshInterval()) * time.Second
|
||||||
|
|
||||||
if interval <= 0 {
|
if interval <= 0 {
|
||||||
@ -19,9 +22,6 @@ func Schedule(widget Scheduler) {
|
|||||||
tick := time.NewTicker(interval)
|
tick := time.NewTicker(interval)
|
||||||
quit := make(chan struct{})
|
quit := make(chan struct{})
|
||||||
|
|
||||||
// Kick off the first refresh and then leave the rest to the timer
|
|
||||||
widget.Refresh()
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-tick.C:
|
case <-tick.C:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user