mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-26 13:48:49 +08:00
29 lines
353 B
Go
29 lines
353 B
Go
package gobot
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
//type Gobot struct{
|
|
// Robot
|
|
// Connections []Connection
|
|
// Devices []Device
|
|
// Name string
|
|
// Work func()
|
|
//}
|
|
|
|
func Every(t time.Duration, f func()) {
|
|
go func(){
|
|
for{
|
|
time.Sleep(t)
|
|
f()
|
|
}
|
|
}()
|
|
}
|
|
|
|
func After(t time.Duration, f func()) {
|
|
go func(){
|
|
time.Sleep(t)
|
|
f()
|
|
}()
|
|
} |