Emitter.New
Overview
New returns an empty Emitter.
Part of the event package — Node.js analog: EventEmitter.
Method on Emitter — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func New() *EmitterCompare: Node.js · Standard Go · gox
js
const emitter = new EventEmitter();go
// sync.Mutex + map[string][]func() or channelsgo
import "github.com/sahilkhaire/gox/event"
em := event.New()Example
go
import "github.com/sahilkhaire/gox/event"
em := event.New()Tips
Obtain a Emitter value first (see constructors on the package overview), then call New.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.