1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00

21 lines
235 B
Go
Raw Normal View History

2013-10-22 16:45:31 -07:00
package gobot
import (
"time"
)
2013-10-23 22:00:03 -07:00
func Every(t time.Duration, f func()) {
2013-10-22 16:45:31 -07:00
go func(){
for{
time.Sleep(t)
2013-10-23 22:00:03 -07:00
f()
2013-10-22 16:45:31 -07:00
}
}()
2013-10-23 22:00:03 -07:00
}
func After(t time.Duration, f func()) {
go func(){
time.Sleep(t)
f()
}()
2013-10-22 16:45:31 -07:00
}