# README
EventEmitter - a simple event emitter
Installation
To install the package, run:
go get github.com/go-zoox/eventemitter
Getting Started
import (
"testing"
"github.com/go-zoox/eventemitter"
)
func main(t *testing.T) {
e := eventemitter.New()
count := 0
e.On("send.notify", eventemitter.HandleFunc(func(payload any) {
count++
t.Log("send.notify", payload)
}))
e.Start()
wg := &sync.WaitGroup{}
for i := 0; i < 10; i++ {
index := i
wg.Add(1)
go func() {
e.Emit("send.notify", index)
wg.Done()
}()
}
wg.Wait()
}
License
GoZoox is released under the MIT License.
# Variables
Version is the current version of the package.
# Interfaces
EventEmitter is a simple event emitter.
Handler is a function that can be registered to an event.