event

package
v0.0.0-...-6902453 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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]) Add

func (events *Events[T]) Add(handlers ...Handler[T])

func (*Events[T]) Disable

func (events *Events[T]) Disable(disable bool)

func (*Events[T]) Disabled

func (events *Events[T]) Disabled() bool

func (*Events[T]) IterHandler

func (events *Events[T]) IterHandler(ctx context.Context, types ...T) <-chan Handler[T]

func (*Events[T]) Remove

func (events *Events[T]) Remove(handlers ...Handler[T])

func (*Events[T]) Reset

func (events *Events[T]) Reset()

func (*Events[T]) Trigger

func (events *Events[T]) Trigger(t T, data any)

func (*Events[T]) Watched

func (events *Events[T]) Watched(types ...T) bool

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]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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