Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
Dispatcher is a very, very basic event dispatcher. It keeps a map between event types, and functions to call when an event is dispatched. There are no background processes involved.
func NewDispatcher ¶
func NewDispatcher() *Dispatcher
NewDispatcher creates a new Dispatcher instance.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(eventType Type)
Dispatch emits an event via this Dispatcher instance, calling any listener functions associated with the given event Type. This method is safe for concurrent use.
func (*Dispatcher) RegisterListener ¶
func (d *Dispatcher) RegisterListener(eventType Type, lfn func())
RegisterListener is used to register an event listener. An event listener is basically just a function that will be called when a given event Type is dispatched. This method is safe for concurrent use.
Click to show internal directories.
Click to hide internal directories.