Versions in this module Expand all Collapse all v1 v1.0.0 Sep 7, 2022 Changes in this version + const AboveNormal + const BelowNormal + const High + const Low + const Max + const Min + const Normal + const Wildcard + var DefaultEM = NewManager("default") + func AddEvent(e Event) + func AddSubscriber(sbr Subscriber) + func AsyncFire(e Event) + func FireBatch(es ...interface{}) []error + func FireEvent(e Event) error + func HasEvent(name string) bool + func HasListeners(name string) bool + func Listen(name string, listener Listener, priority ...int) + func On(name string, listener Listener, priority ...int) + func Reset() + func Subscribe(sbr Subscriber) + func TriggerEvent(e Event) error + type BasicEvent struct + func NewBasic(name string, data M) *BasicEvent + func (e *BasicEvent) Abort(abort bool) + func (e *BasicEvent) Add(key string, val interface{}) + func (e *BasicEvent) AttachTo(em ManagerFace) + func (e *BasicEvent) Data() map[string]interface{} + func (e *BasicEvent) Fill(target interface{}, data M) *BasicEvent + func (e *BasicEvent) Get(key string) interface{} + func (e *BasicEvent) IsAborted() bool + func (e *BasicEvent) Name() string + func (e *BasicEvent) Set(key string, val interface{}) + func (e *BasicEvent) SetData(data M) Event + func (e *BasicEvent) SetName(name string) *BasicEvent + func (e *BasicEvent) SetTarget(target interface{}) *BasicEvent + func (e *BasicEvent) Target() interface{} + type ByPriorityItems []*ListenerItem + func (ls ByPriorityItems) Len() int + func (ls ByPriorityItems) Less(i, j int) bool + func (ls ByPriorityItems) Swap(i, j int) + type Event interface + Abort func(bool) + Add func(key string, val interface{}) + Data func() map[string]interface{} + Get func(key string) interface{} + IsAborted func() bool + Name func() string + Set func(key string, val interface{}) + SetData func(M) Event + func Fire(name string, params M) (error, Event) + func GetEvent(name string) (Event, bool) + func MustFire(name string, params M) Event + func MustTrigger(name string, params M) Event + func Trigger(name string, params M) (error, Event) + type Listener interface + Handle func(e Event) error + type ListenerFunc func(e Event) error + func (fn ListenerFunc) Handle(e Event) error + type ListenerItem struct + Listener Listener + Priority int + type ListenerQueue struct + func (lq *ListenerQueue) Clear() + func (lq *ListenerQueue) IsEmpty() bool + func (lq *ListenerQueue) Items() []*ListenerItem + func (lq *ListenerQueue) Len() int + func (lq *ListenerQueue) Push(li *ListenerItem) *ListenerQueue + func (lq *ListenerQueue) Remove(listener Listener) + func (lq *ListenerQueue) Sort() *ListenerQueue + type M = map[string]interface + type Manager struct + EnableLock bool + func NewManager(name string) *Manager + func (em *Manager) AddEvent(e Event) + func (em *Manager) AddListener(name string, listener Listener, priority ...int) + func (em *Manager) AddSubscriber(sbr Subscriber) + func (em *Manager) AsyncFire(e Event) + func (em *Manager) AwaitFire(e Event) (err error) + func (em *Manager) Clear() + func (em *Manager) Fire(name string, params M) (err error, e Event) + func (em *Manager) FireBatch(es ...interface{}) (ers []error) + func (em *Manager) FireEvent(e Event) (err error) + func (em *Manager) GetEvent(name string) (e Event, ok bool) + func (em *Manager) HasEvent(name string) bool + func (em *Manager) HasListeners(name string) bool + func (em *Manager) Listen(name string, listener Listener, priority ...int) + func (em *Manager) ListenedNames() map[string]int + func (em *Manager) Listeners() map[string]*ListenerQueue + func (em *Manager) ListenersByName(name string) *ListenerQueue + func (em *Manager) ListenersCount(name string) int + func (em *Manager) MustFire(name string, params M) Event + func (em *Manager) MustTrigger(name string, params M) Event + func (em *Manager) On(name string, listener Listener, priority ...int) + func (em *Manager) RemoveEvent(name string) + func (em *Manager) RemoveEvents() + func (em *Manager) RemoveListener(name string, listener Listener) + func (em *Manager) RemoveListeners(name string) + func (em *Manager) Reset() + func (em *Manager) Subscribe(sbr Subscriber) + func (em *Manager) Trigger(name string, params M) (error, Event) + type ManagerFace interface + AddEvent func(Event) + Fire func(name string, params M) (error, Event) + On func(name string, listener Listener, priority ...int) + type Subscriber interface + SubscribedEvents func() map[string]interface{}