Documentation ¶
Index ¶
- Variables
- type EmitOption
- type Event
- func (t *Event[T]) Emit(ctx context.Context, msg T, opts ...EmitOption) error
- func (t *Event[T]) EmitAsync(ctx context.Context, msg T, opts ...EmitOption) error
- func (t *Event[T]) Listeners() []*Listener[T]
- func (t *Event[T]) ListenersCount() int
- func (t *Event[T]) Off(listener *Listener[T]) error
- func (t *Event[T]) OffAll()
- func (t *Event[T]) On(handler Handler[T]) *Listener[T]
- type Handler
- type HandlerFunc
- type Listener
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrListenerNotFound = errors.New("[event_bus] listener not found")
Functions ¶
This section is empty.
Types ¶
type EmitOption ¶
type EmitOption func(*emitOptions)
func WithEmitAsync ¶
func WithEmitAsync() EmitOption
func WithEmitSkipErrors ¶
func WithEmitSkipErrors() EmitOption
type Event ¶
type Event[T any] struct { // contains filtered or unexported fields }
func (*Event[T]) Emit ¶
func (t *Event[T]) Emit(ctx context.Context, msg T, opts ...EmitOption) error
func (*Event[T]) EmitAsync ¶
func (t *Event[T]) EmitAsync(ctx context.Context, msg T, opts ...EmitOption) error
func (*Event[T]) ListenersCount ¶
type HandlerFunc ¶
Click to show internal directories.
Click to hide internal directories.