Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface { // Name represents the name of the event. Name() string // Info contains the data related to a particular event. Info() interface{} // Sender represents the object that generated a particular event. Sender() interface{} // Time specifies the time in which a concrete event was generated. Time() time.Time }
Event represents a container for information broadcast through an sonar to all registered handlers.
type EventBuilder ¶
type EventBuilder struct {
// contains filtered or unexported fields
}
EventBuilder represents a generic event builder.
func NewEventBuilder ¶
func NewEventBuilder(eventName string) *EventBuilder
NewEventBuilder returns a new event builder instance.
func (*EventBuilder) Build ¶
func (b *EventBuilder) Build() Event
Build returns a new generated event.
func (*EventBuilder) WithInfo ¶
func (b *EventBuilder) WithInfo(info interface{}) *EventBuilder
WithInfo attaches info field to the builder.
func (*EventBuilder) WithSender ¶
func (b *EventBuilder) WithSender(sender interface{}) *EventBuilder
WithSender attaches sender object to the builder.
type Sonar ¶
type Sonar struct {
// contains filtered or unexported fields
}
Sonar defines common publish/subscribe interface.
func (*Sonar) Subscribe ¶
Subscribe adds an entry to the sonar to receive events that passed to the provided handler.
func (*Sonar) Unsubscribe ¶
Unsubscribe removes an existing entry from the sonar.
Click to show internal directories.
Click to hide internal directories.