Documentation ¶
Overview ¶
events defines an event subscriber and dispatcher Deprecated: use EventBus instead
Index ¶
- type EmitterInterface
- type Event
- type EventEmitterdeprecated
- func (e *EventEmitter) Emit(_ context.Context, evt Event)deprecated
- func (e *EventEmitter) GetBus() (bus event.Bus)
- func (e *EventEmitter) GlobalChannel(ctx context.Context) (cc <-chan Event)deprecated
- func (e *EventEmitter) SetBus(bus event.Bus) (err error)
- func (e *EventEmitter) Subscribe(ctx context.Context) <-chan Eventdeprecated
- func (e *EventEmitter) UnsubscribeAll()deprecated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmitterInterface ¶
type EmitterInterface interface { // Deprecated: Emit Sends an event to the subscribed listeners Emit(context.Context, Event) // Deprecated: GlobalChannel returns a glocal channel that receives emitted events GlobalChannel(ctx context.Context) <-chan Event // Deprecated: Subscribe Returns a channel that receives emitted events Subscribe(ctx context.Context) <-chan Event // Deprecated: UnsubscribeAll close all listeners channels UnsubscribeAll() }
EmitterInterface Root interface for events dispatch
type EventEmitter
deprecated
type EventEmitter struct {
// contains filtered or unexported fields
}
Deprecated: use event bus directly EventEmitter Registers listeners and dispatches events to them
func (*EventEmitter) Emit
deprecated
func (e *EventEmitter) Emit(_ context.Context, evt Event)
Deprecated: use event bus directly Emit Sends an event to the subscribed listeners
func (*EventEmitter) GetBus ¶
func (e *EventEmitter) GetBus() (bus event.Bus)
func (*EventEmitter) GlobalChannel
deprecated
func (e *EventEmitter) GlobalChannel(ctx context.Context) (cc <-chan Event)
Deprecated: use event bus directly GlobalChannel returns a glocal channel that receives emitted events
func (*EventEmitter) SetBus ¶
func (e *EventEmitter) SetBus(bus event.Bus) (err error)
set event bus, return an error if the bus is already set
func (*EventEmitter) Subscribe
deprecated
func (e *EventEmitter) Subscribe(ctx context.Context) <-chan Event
Deprecated: use event Bus directly Subscribe Returns a channel that receives emitted events
func (*EventEmitter) UnsubscribeAll
deprecated
func (e *EventEmitter) UnsubscribeAll()
Deprecated: use event bus directly UnsubscribeAll close all listeners channels