Documentation ¶
Index ¶
- type Events
- func (events *Events[T]) Add(handlers ...Handler[T])
- func (events *Events[T]) Disable(disable bool)
- func (events *Events[T]) Disabled() bool
- func (events *Events[T]) IterHandler(ctx context.Context, types ...T) <-chan Handler[T]
- func (events *Events[T]) Remove(handlers ...Handler[T])
- func (events *Events[T]) Reset()
- func (events *Events[T]) Trigger(t T, data any)
- func (events *Events[T]) Watched(types ...T) bool
- type HandleFunc
- type Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Events ¶
type Events[T comparable] struct { // contains filtered or unexported fields }
func (*Events[T]) IterHandler ¶
type HandleFunc ¶
type HandleFunc[D any] func(data D)
type Handler ¶
type Handler[T comparable] interface { Type() T Metadata() []any Handle(data any) }
func NewHandler ¶
func NewHandler[T comparable](typ T, handle func(), metadata ...any) Handler[T]
func NewHandlerWithEventData ¶
func NewHandlerWithEventData[T comparable, D any](typ T, handle HandleFunc[D], metadata ...any) Handler[T]
Click to show internal directories.
Click to hide internal directories.