cfha/monitor/handler.go

21 lines
320 B
Go
Raw Normal View History

2015-08-21 17:27:26 +00:00
package monitor
type handler interface{
handle(transition Transition)
}
type GenericHandler struct {
channel chan Transition
}
func runHandler(input chan Transition, handler handler) GenericHandler {
go func() {
for true {
handler.handle(<-input)
}
}()
return GenericHandler{
input,
}
}