Skip to content

Commit

Permalink
Add Driver channel for events
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Oct 29, 2013
1 parent dbc602d commit d05268f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Driver struct {
Pin string
Name string
Params map[string]string
Events map[string]chan interface{}
}

func NewDriver(d Driver) Driver {
Expand Down
9 changes: 8 additions & 1 deletion gobot.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ func After(t string, f func()) {
func Random(min int, max int) int {
rand.Seed(time.Now().UTC().UnixNano())
return rand.Intn(max - min) + min
}
}

func On(cs chan interface{}) interface{}{
for s := range cs {
return s
}
return nil
}

0 comments on commit d05268f

Please sign in to comment.