1
0
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:
Hossein Mehrabi 2018-05-29 20:33:34 +04:30 committed by Chris Cummer
parent 3bd0bda57e
commit 6a35f122a3

View File

@ -19,7 +19,8 @@ var started = false
type Widget struct {
wtf.TextWidget
CurrentIcon int
// time interval for send http request
updateInterval int
*list
}
@ -28,7 +29,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")
@ -71,7 +73,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)
}
}()
@ -127,5 +129,4 @@ func (widget *Widget) updateCurrencies() {
}
}
}