Documentation ¶
Index ¶
- type Dispatcher
- func (d *Dispatcher) Broadcast(ctx context.Context, params ...interface{}) error
- func (d *Dispatcher) Close() error
- func (d *Dispatcher) CountListeners(eventName string) int
- func (d *Dispatcher) EmitEvent(ctx context.Context, name string, params ...interface{}) (err error)
- func (d *Dispatcher) EventExists(name string) bool
- func (d *Dispatcher) FilterEvents(filterFunc func(string, []types.EventListener) bool) []string
- func (d *Dispatcher) ListEvents() []string
- func (d *Dispatcher) Subscribe(ctx context.Context, name string, fn interface{}, maxTrigger int) (context.CancelFunc, error)
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
func (*Dispatcher) Broadcast ¶
func (d *Dispatcher) Broadcast(ctx context.Context, params ...interface{}) error
Broadcast fires an event to all listeners
func (*Dispatcher) CountListeners ¶
func (d *Dispatcher) CountListeners(eventName string) int
CountListeners returns the number of listeners for an event
func (*Dispatcher) EmitEvent ¶
func (d *Dispatcher) EmitEvent(ctx context.Context, name string, params ...interface{}) (err error)
EmitEvent fires an event
func (*Dispatcher) EventExists ¶
func (d *Dispatcher) EventExists(name string) bool
EventExists checks if an event exists
func (*Dispatcher) FilterEvents ¶
func (d *Dispatcher) FilterEvents(filterFunc func(string, []types.EventListener) bool) []string
FilterEvents returns a list of events filtered by a filter function
func (*Dispatcher) ListEvents ¶
func (d *Dispatcher) ListEvents() []string
ListEvents returns a list of all events
func (*Dispatcher) Subscribe ¶
func (d *Dispatcher) Subscribe(ctx context.Context, name string, fn interface{}, maxTrigger int) (context.CancelFunc, error)
Subscribe registers a listener for an event with optional max call limit
type Option ¶
type Option func(*Options)
func WithLogger ¶
WithLogger sets the logger on the Options struct.
Click to show internal directories.
Click to hide internal directories.