events

package
v1.50.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 7 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultQueueSize = 16

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewEmitter

func NewEmitter[K comparable, V any](opts ...Option) *Emitter[K, V]

func (*Emitter[K, V]) Emit

func (e *Emitter[K, V]) Emit(k K, v V)

func (*Emitter[K, V]) Notify

func (e *Emitter[K, V]) Notify(k K, ch chan V) func()

func (*Emitter[K, V]) Observe

func (e *Emitter[K, V]) Observe(k K) Observer[V]

func (*Emitter[K, V]) ObservedKeys

func (e *Emitter[K, V]) ObservedKeys() []K

func (*Emitter[K, V]) On

func (e *Emitter[K, V]) On(k K, f func(V)) func()

type Observer

type Observer[V any] interface {
	Stop()
	Events() <-chan V
	// contains filtered or unexported methods
}

func NewObserver

func NewObserver[V any](stopFunc func()) (Observer[V], func(v V))

type ObserverList

type ObserverList[V any] struct {
	// contains filtered or unexported fields
}

func NewObserverList

func NewObserverList[V any](opts ...Option) *ObserverList[V]

func (*ObserverList[V]) Emit

func (l *ObserverList[V]) Emit(v V)

func (*ObserverList[V]) Len

func (l *ObserverList[V]) Len() int

func (*ObserverList[V]) Notify

func (l *ObserverList[V]) Notify(ch chan V) func()

func (*ObserverList[V]) Observe

func (l *ObserverList[V]) Observe() Observer[V]

func (*ObserverList[V]) On

func (l *ObserverList[V]) On(f func(V)) func()

type Option

type Option func(o *Options)

func WithBlocking

func WithBlocking() Option

func WithLogger

func WithLogger(l logger.Logger) Option

func WithOptions

func WithOptions(src Options) Option

func WithQueueSize

func WithQueueSize(size int) Option

type Options

type Options struct {
	QueueSize int
	Blocking  bool
	Logger    logger.Logger
}

func DefaultOptions

func DefaultOptions() Options

Jump to

Keyboard shortcuts

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