Documentation ¶
Overview ¶
Package flowutil contains utilities to manage control flow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventCallback ¶
type EventCallback func(event string, eventSource interface{})
EventCallback is the callback function which is called when an event was observed.
type EventPump ¶
type EventPump struct {
// contains filtered or unexported fields
}
EventPump implements the observer pattern. Observers can subscribe to receive notifications on certain events. Observed objects can send notifications.
func (*EventPump) AddObserver ¶
func (ep *EventPump) AddObserver(event string, eventSource interface{}, callback EventCallback)
AddObserver adds a new observer to the event pump. An observer can subscribe to a given event from a given event source. If the event is an empty string then the observer subscribes to all events from the event source. If the eventSource is nil then the observer subscribes to all event sources.
func (*EventPump) PostEvent ¶
PostEvent posts an event to this event pump from a given event source.
func (*EventPump) RemoveObservers ¶
RemoveObservers removes observers from the event pump. If the event is an empty string then the observer is removed from all events. If the eventSource is nil then all observers of the event are dropped.