observer

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 1 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL