Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus just controls when topic handlers are invoked.
type Callback ¶ added in v1.2.0
Callbacks are hooked up to Topics via Subscription. They are called for each Event that is Published to the Topic.
type CallbackManager ¶ added in v1.2.0
type CallbackManager interface {
// Wait will block until the publish is queued.
Wait()
// Unsubscribe will queue an event to unsubscribe the callback.
// The Wait function returned by Unsubscribe will block until that
// removal event is queued.
//
// Note that the callback may still be invoked even after
// CallbackManager.Unsubscribe()() is called if there is a backlog for
// this topic.
Unsubscribe() (Wait func())
}
CallbackManager contains utility functions for managing a callback.
type Topic ¶
type Topic[T any] struct { // contains filtered or unexported fields }
Topic is what users interact with. Each one watches the station to know when it must run.
func (*Topic[T]) Publish ¶
Publish submits an event to queue. When processed, it will be sent to every Callback that is Subscribed to this Topic.
func (*Topic[T]) Subscribe ¶
func (t *Topic[T]) Subscribe(callback Callback[T]) CallbackManager
Subscribe will invoke callback for each event Published to this topic.
Click to show internal directories.
Click to hide internal directories.