Documentation
¶
Index ¶
- Constants
- func Heartbeat(initdead, keepalive float64, f func(*Event))
- func OnlyData[T any](handle func(T)) func(*Event)
- func WithData[T any](handles ...func(*Event, T)) func(*Event)
- type AsyncEvent
- func (a *AsyncEvent[K]) Dispatch(cmd K, data any)
- func (a *AsyncEvent[K]) On(name string, cmd K, handles ...func(*Event)) func()
- func (a *AsyncEvent[K]) OnAll(handles ...func(*Event)) func()
- func (a *AsyncEvent[K]) OnCommand(cmd K, handles ...func(*Event)) func()
- func (a *AsyncEvent[K]) Register(name string, match func(cmd, key K) bool)
- type AsyncEventS
- type Event
Constants ¶
View Source
const ( MIN int = -2147483648 ALL string = "__ALL__" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AsyncEvent ¶
type AsyncEvent[K comparable] struct { // contains filtered or unexported fields }
func New ¶
func New[K comparable](all K) AsyncEvent[K]
func (*AsyncEvent[K]) Dispatch ¶
func (a *AsyncEvent[K]) Dispatch(cmd K, data any)
func (*AsyncEvent[K]) On ¶
func (a *AsyncEvent[K]) On(name string, cmd K, handles ...func(*Event)) func()
func (*AsyncEvent[K]) OnAll ¶
func (a *AsyncEvent[K]) OnAll(handles ...func(*Event)) func()
func (*AsyncEvent[K]) OnCommand ¶
func (a *AsyncEvent[K]) OnCommand(cmd K, handles ...func(*Event)) func()
func (*AsyncEvent[K]) Register ¶
func (a *AsyncEvent[K]) Register(name string, match func(cmd, key K) bool)
type AsyncEventS ¶
type AsyncEventS struct {
AsyncEvent[string]
}
func Default ¶
func Default() AsyncEventS
func (*AsyncEventS) OnRegexp ¶
func (a *AsyncEventS) OnRegexp(pattern string, handles ...func(*Event)) func()
Click to show internal directories.
Click to hide internal directories.