mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
add time interval for send http request
This commit is contained in:
parent
909b82f8de
commit
50843a5069
@ -21,7 +21,8 @@ var started = false
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
|
||||
CurrentIcon int
|
||||
// time interval for send http request
|
||||
updateInterval int
|
||||
|
||||
*list
|
||||
}
|
||||
@ -30,7 +31,8 @@ type Widget struct {
|
||||
func NewWidget() *Widget {
|
||||
started = false
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false),
|
||||
TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false),
|
||||
updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10),
|
||||
}
|
||||
|
||||
currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies")
|
||||
@ -73,7 +75,7 @@ func (widget *Widget) Refresh() {
|
||||
go func() {
|
||||
for {
|
||||
widget.updateCurrencies()
|
||||
time.Sleep(time.Duration(widget.RefreshInterval()) * time.Second)
|
||||
time.Sleep(time.Duration(widget.updateInterval) * time.Second)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -129,5 +131,4 @@ func (widget *Widget) updateCurrencies() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user