Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Subscription ¶
type Subscription[T any] struct { // contains filtered or unexported fields }
Subscription represents a registration for notifications.
func (*Subscription[T]) Delete ¶
func (s *Subscription[T]) Delete()
Delete removes the subscription from what it is watching.
type SubscriptionSet ¶
type SubscriptionSet[T any] struct { // contains filtered or unexported fields }
SubscriptionSet holds a list of subscribers.
func NewSubscriptionSet ¶
func NewSubscriptionSet[T any]() *SubscriptionSet[T]
NewSubscriptionSet creates a new SubscriptionSet.
func (*SubscriptionSet[T]) Clear ¶
func (s *SubscriptionSet[T]) Clear()
Clear removes all subscriptions.
func (*SubscriptionSet[T]) Each ¶
func (s *SubscriptionSet[T]) Each(fn func(callback T))
Each iterates over all subscriptions.
func (*SubscriptionSet[T]) Subscribe ¶
func (s *SubscriptionSet[T]) Subscribe(callback T) *Subscription[T]
Subscribe adds a subscription to this set.
func (*SubscriptionSet[T]) Unsubscribe ¶
func (s *SubscriptionSet[T]) Unsubscribe(subscription *Subscription[T])
Unsubscribe removes the subscription from this set.
Click to show internal directories.
Click to hide internal directories.