An idiomatic async emitter for go✨
go get https://github.com/saranonearth/goasynem
func main() {
e := &goasynem.Goasynem{}
e.Subscribe("event", func(c interface{}) error {
fmt.Println(c)
return nil
})
e.Emit("event", fmt.Sprintf("Done %d", 1))
}
func main() {
e := &goasynem.Goasynem{}
e.Subscribe("event", func(c interface{}) error {
fmt.Println(c)
return nil
})
errCh := e.Emit("event", fmt.Sprintf("Done %d", 1))
err := <-errCh
if err != nil {
fmt.Println("Error found", err)
}
}
Once you have this installed, simply go get this repository and run the following commands to download the package.
go get -u github.com/saranonearth/goasynem
If you want to run the tests, simply run go test command as demonstrated below.
make test
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
This is free software under the terms of the MIT license