Documentation
¶
Index ¶
- Variables
- func DefaultEventDebug(dis EventDispatcherInterface, key string, e EventInterface)
- func EAll(name string) string
- type Callback
- type CallbackFunc
- type CallbackFuncE
- type Event
- func (d *Event) Data() interface{}
- func (d *Event) Dispatcher() EventDispatcherInterface
- func (d *Event) Error() error
- func (d *Event) Name() string
- func (e *Event) Names() []string
- func (d *Event) Result() interface{}
- func (d *Event) SetData(value interface{})
- func (d *Event) SetDispatcher(dis EventDispatcherInterface)
- func (d *Event) SetError(err error)
- func (d *Event) SetResult(value interface{})
- func (e *Event) String() string
- func (e *Event) With(name string) (done func())
- func (e *Event) WithDispatcher(dis EventDispatcherInterface) (done func())
- type EventDispatcher
- func (ed *EventDispatcher) AllListeners() map[string][]Callback
- func (ed *EventDispatcher) DisableAnyTrigger()
- func (ed *EventDispatcher) DisableDebug()
- func (ed *EventDispatcher) Dispatcher() EventDispatcherInterface
- func (ed *EventDispatcher) EnableAnyTrigger()
- func (ed *EventDispatcher) EnableDebug()
- func (ed *EventDispatcher) GetDefinedDispatcher() EventDispatcherInterface
- func (ed *EventDispatcher) IsAnyTrigger() bool
- func (ed *EventDispatcher) IsDebugEnabled() bool
- func (ed *EventDispatcher) Listeners(key string) (lis []Callback, ok bool)
- func (ed *EventDispatcher) Logger() logging.Logger
- func (ed *EventDispatcher) On(eventName string, callbacks ...interface{})
- func (ed *EventDispatcher) OnE(eventName string, callbacks ...interface{}) error
- func (ed *EventDispatcher) SetAnyTrigger(v bool)
- func (ed *EventDispatcher) SetDebug(v bool)
- func (ed *EventDispatcher) SetDispatcher(dis EventDispatcherInterface)
- func (ed *EventDispatcher) SetLogger(log logging.Logger)
- func (ed *EventDispatcher) Trigger(e EventInterface) (err error)
- type EventDispatcherInterface
- type EventInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var PREFIX = path_helpers.GetCalledDir()
Functions ¶
func DefaultEventDebug ¶
func DefaultEventDebug(dis EventDispatcherInterface, key string, e EventInterface)
Types ¶
type Callback ¶
type Callback interface {
Call(e EventInterface) error
}
func SimpleCallback ¶
func SimpleCallback(f func()) Callback
func SimpleCallbackE ¶
type CallbackFunc ¶
type CallbackFunc func(e EventInterface)
func (CallbackFunc) Call ¶
func (c CallbackFunc) Call(e EventInterface) error
type CallbackFuncE ¶
type CallbackFuncE func(e EventInterface) error
func (CallbackFuncE) Call ¶
func (c CallbackFuncE) Call(e EventInterface) error
type Event ¶
type Event struct {
PName string
PData interface{}
PResult interface{}
PError error
PCurrentName string
PDispatcher EventDispatcherInterface
// contains filtered or unexported fields
}
func (*Event) Dispatcher ¶
func (d *Event) Dispatcher() EventDispatcherInterface
func (*Event) SetDispatcher ¶
func (d *Event) SetDispatcher(dis EventDispatcherInterface)
func (*Event) WithDispatcher ¶
func (e *Event) WithDispatcher(dis EventDispatcherInterface) (done func())
type EventDispatcher ¶
type EventDispatcher struct {
// contains filtered or unexported fields
}
func New ¶
func New() *EventDispatcher
func (*EventDispatcher) AllListeners ¶
func (ed *EventDispatcher) AllListeners() map[string][]Callback
func (*EventDispatcher) DisableAnyTrigger ¶
func (ed *EventDispatcher) DisableAnyTrigger()
func (*EventDispatcher) DisableDebug ¶
func (ed *EventDispatcher) DisableDebug()
func (*EventDispatcher) Dispatcher ¶
func (ed *EventDispatcher) Dispatcher() EventDispatcherInterface
func (*EventDispatcher) EnableAnyTrigger ¶
func (ed *EventDispatcher) EnableAnyTrigger()
func (*EventDispatcher) EnableDebug ¶
func (ed *EventDispatcher) EnableDebug()
func (*EventDispatcher) GetDefinedDispatcher ¶
func (ed *EventDispatcher) GetDefinedDispatcher() EventDispatcherInterface
func (*EventDispatcher) IsAnyTrigger ¶
func (ed *EventDispatcher) IsAnyTrigger() bool
func (*EventDispatcher) IsDebugEnabled ¶
func (ed *EventDispatcher) IsDebugEnabled() bool
func (*EventDispatcher) Listeners ¶
func (ed *EventDispatcher) Listeners(key string) (lis []Callback, ok bool)
func (*EventDispatcher) Logger ¶
func (ed *EventDispatcher) Logger() logging.Logger
func (*EventDispatcher) On ¶
func (ed *EventDispatcher) On(eventName string, callbacks ...interface{})
func (*EventDispatcher) OnE ¶
func (ed *EventDispatcher) OnE(eventName string, callbacks ...interface{}) error
func (*EventDispatcher) SetAnyTrigger ¶
func (ed *EventDispatcher) SetAnyTrigger(v bool)
func (*EventDispatcher) SetDebug ¶
func (ed *EventDispatcher) SetDebug(v bool)
func (*EventDispatcher) SetDispatcher ¶
func (ed *EventDispatcher) SetDispatcher(dis EventDispatcherInterface)
func (*EventDispatcher) SetLogger ¶
func (ed *EventDispatcher) SetLogger(log logging.Logger)
func (*EventDispatcher) Trigger ¶
func (ed *EventDispatcher) Trigger(e EventInterface) (err error)
type EventDispatcherInterface ¶
type EventDispatcherInterface interface {
On(eventName string, callbacks ...interface{})
OnE(eventName string, callbacks ...interface{}) error
Trigger(e EventInterface) error
IsAnyTrigger() bool
SetAnyTrigger(v bool)
EnableAnyTrigger()
DisableAnyTrigger()
Listeners(key string) (lis []Callback, ok bool)
AllListeners() map[string][]Callback
SetLogger(log logging.Logger)
Logger() logging.Logger
SetDebug(v bool)
IsDebugEnabled() bool
EnableDebug()
DisableDebug()
Dispatcher() EventDispatcherInterface
SetDispatcher(dis EventDispatcherInterface)
}
type EventInterface ¶
type EventInterface interface {
Name() string
Names() []string
SetData(value interface{})
Data() interface{}
SetResult(value interface{})
Result() interface{}
SetError(err error)
Error() error
Dispatcher() EventDispatcherInterface
SetDispatcher(dis EventDispatcherInterface)
With(name string) (done func())
WithDispatcher(dis EventDispatcherInterface) (done func())
}
Click to show internal directories.
Click to hide internal directories.