Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Publish ¶
func Publish[T Bus](broker *Dispatcher, ev T)
Publish writes an event into the dispatcher
func Subscribe ¶
func Subscribe[T Bus](broker *Dispatcher, handler func(T)) context.CancelFunc
Subscribe subscribes to an event, the type of the event will be automatically inferred from the provided type. Must be constant for this to work.
func SubscribeTo ¶
func SubscribeTo[T Bus](broker *Dispatcher, eventType uint32, handler func(T)) context.CancelFunc
SubscribeTo subscribes to an event with the specified event type.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher represents an event dispatcher.
func NewDispatcher ¶
func NewDispatcher() *Dispatcher
NewDispatcher creates a new dispatcher of events.
Click to show internal directories.
Click to hide internal directories.