Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher represents an object that can dispatch simple events (name + payload)
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(name string, payload interface{})
Dispatch dispatches a payload for a specific name
func (*Dispatcher) On ¶
func (d *Dispatcher) On(name string, h EventHandler)
On adds an event handler for a specific name
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start(ctx context.Context)
Start starts the dispatcher. It is blocking
type EventHandler ¶
type EventHandler func(payload interface{})
EventHandler represents a function that can handler an event's payload
Click to show internal directories.
Click to hide internal directories.