Documentation ¶
Overview ¶
Package events provides an event dispatcher and registration framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
Dispatcher objects can register callbacks for specific events, then when those events occur, dispatch them to all callback functions.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(etype Type, value interface{}) error
Dispatch an event, ensuring that the event is properly formatted. Currently this method simply warns if there is an error. TODO: return list of errors or do better error handling.
func (*Dispatcher) Init ¶
func (d *Dispatcher) Init(source interface{})
Init a dispatcher with the source, creating the callbacks map.
func (*Dispatcher) Register ¶
func (d *Dispatcher) Register(etype Type, callback Callback)
Register a callback function for the specified event type.
func (*Dispatcher) Remove ¶
func (d *Dispatcher) Remove(etype Type, callback Callback)
Remove a callback function for the specified event type.
Click to show internal directories.
Click to hide internal directories.