Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster[T any] struct { // contains filtered or unexported fields }
func New ¶
func New[T any]() *Broadcaster[T]
New creates a new Broadcaster with the given interval and key type.
func (*Broadcaster[T]) Broadcast ¶
func (b *Broadcaster[T]) Broadcast(value T)
Broadcast sends the given value to all subscribers.
func (*Broadcaster[T]) Close ¶
func (b *Broadcaster[T]) Close()
Close closes the Broadcaster. It blocks until all events have been sent to the subscribers. The Broadcaster will be a no-op after this call.
func (*Broadcaster[T]) Subscribe ¶
func (b *Broadcaster[T]) Subscribe(ctx context.Context, ch ...chan<- T)
Subscribe adds a new event channel subscriber. If the batcher is closed, the subscriber is silently dropped.
Click to show internal directories.
Click to hide internal directories.