mirror of https://github.com/pocke/goevent.git
fbefc5ea1f | ||
---|---|---|
.travis.yml | ||
LICENSE | ||
README.md | ||
errors.go | ||
goevent.go | ||
goevent_test.go | ||
table.go | ||
table_test.go |
README.md
goevent
goevent is event dispatcher written by golang.
example
listen for event
e := goevent.New()
e.On(func(i int, s string){
fmt.Printf("%d: %s\n", i, s)
})
Trigger
e.Trigger(1, "foo")
Use event table
table := goevent.NewTable()
table.On("foo", func(i int){
fmt.Printf("foo: %d\n", i)
})
table.On("bar", func(s string){
fmt.Printf("bar: %s\n", s)
})
table.Trigger("foo", 1)
table.Trigger("bar", "hoge")
table.Trigger("bar", 38) // retrun error
LICENSE
Copyright © 2015 pocke Licensed [MIT][mit] [MIT]: http://www.opensource.org/licenses/mit-license.php