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 { type Widget struct {
wtf.TextWidget wtf.TextWidget
CurrentIcon int // time interval for send http request
updateInterval int
*list *list
} }
@ -28,7 +29,8 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
started = false started = false
widget := Widget{ 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") currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies")
@ -71,7 +73,7 @@ func (widget *Widget) Refresh() {
go func() { go func() {
for { for {
widget.updateCurrencies() 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() {
} }
} }
} }