Help us shape the future of Go! Take the 2026 Go Developer Survey

events

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 5

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