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 manages event listeners and dispatches events.
func NewDispatcher ¶
func NewDispatcher() *Dispatcher
NewDispatcher returns an empty event dispatcher.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(event string, payload interface{})
Dispatch fires all handlers for the event asynchronously.
func (*Dispatcher) DispatchSync ¶
func (d *Dispatcher) DispatchSync(event string, payload interface{})
DispatchSync fires all handlers for the event sequentially.
func (*Dispatcher) Has ¶
func (d *Dispatcher) Has(event string) bool
Has returns true if any listener is registered for the event.
func (*Dispatcher) Listen ¶
func (d *Dispatcher) Listen(event string, handler Handler)
Listen registers a handler for the named event.
Click to show internal directories.
Click to hide internal directories.