Documentation ¶
Overview ¶
Dump from https://github.com/moleculer-go/goemitter/blob/master/goemitter.go
Index ¶
- type Emitter
- func (emitter *Emitter) AddListener(event string, callback func(...interface{})) *Emitter
- func (emitter *Emitter) Destruct()
- func (emitter *Emitter) EmitAsync(event string, args []interface{}) *Emitter
- func (emitter *Emitter) EmitSync(event string, args ...interface{}) *Emitter
- func (emitter *Emitter) Listeners(event string) []Listener
- func (emitter *Emitter) ListenersCount(event string) int
- func (emitter *Emitter) On(event string, callback func(...interface{})) *Emitter
- func (emitter *Emitter) Once(event string, callback func(...interface{})) *Emitter
- func (emitter *Emitter) RemoveAllListeners(event interface{}) *Emitter
- func (emitter *Emitter) RemoveListener(event string, callback func(...interface{})) *Emitter
- type Listener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter - our listeners container
func (*Emitter) AddListener ¶
AddListener() - register a new listener on the specified event
func (*Emitter) Destruct ¶
func (emitter *Emitter) Destruct()
Destruct() - free memory from an emitter instance
func (*Emitter) EmitAsync ¶
EmitAsync() - run all listeners of the specified event in asynchronous mode using goroutines
func (*Emitter) EmitSync ¶
EmitSync() - run all listeners of the specified event in synchronous mode
func (*Emitter) Listeners ¶
Listeners() - return an array with the registered listeners in the specified event
func (*Emitter) ListenersCount ¶
ListenersCount() - return the count of listeners in the speicifed event
func (*Emitter) RemoveAllListeners ¶
RemoveAllListeners() - remove all listeners from (all/event)
func (*Emitter) RemoveListener ¶
RemoveListeners() - remove the specified callback from the specified events' listeners