Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface { // GetType returns the type of the event GetType() Type // GetData returns the wrapped event data GetData() any }
Event is the abstraction for any event
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the subscription manager
func NewManager ¶
func NewManager() *Manager
NewManager creates a new instance of the subscription manager
func (*Manager) CancelSubscription ¶
func (em *Manager) CancelSubscription(id SubscriptionID)
CancelSubscription stops a subscription for events
func (*Manager) Close ¶
func (em *Manager) Close()
Close stops the event manager, effectively cancelling all subscriptions
func (*Manager) SignalEvent ¶
SignalEvent is a helper method for alerting listeners of a new message event
func (*Manager) Subscribe ¶
func (em *Manager) Subscribe(eventTypes []Type) *Subscription
Subscribe registers a new listener for events
type Subscription ¶
type Subscription struct { // SubCh is the notification channel // on which the listener will receive notifications SubCh chan Event // ID is the unique identifier of the subscription ID SubscriptionID }
Subscription is the subscription returned to the user
type SubscriptionID ¶
type SubscriptionID int32
Click to show internal directories.
Click to hide internal directories.