Documentation ¶
Overview ¶
events defines an event subscriber and dispatcher
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmitterInterface ¶
type EmitterInterface interface { // Emit Sends an event to the subscribed listeners Emit(Event) // Subscribe Registers a callback that will receive emitted events Subscribe(context.Context, func(Event)) // UnsubscribeAll removes all listeners UnsubscribeAll() }
EmitterInterface Root interface for events dispatch
type EventEmitter ¶
type EventEmitter struct {
Subscribers []*eventSubscription
}
EventEmitter Registers listeners and dispatches events to them
func (*EventEmitter) Emit ¶
func (e *EventEmitter) Emit(evt Event)
func (*EventEmitter) Subscribe ¶
func (e *EventEmitter) Subscribe(ctx context.Context, handler func(Event))
func (*EventEmitter) UnsubscribeAll ¶
func (e *EventEmitter) UnsubscribeAll()
Click to show internal directories.
Click to hide internal directories.