Documentation
¶
Index ¶
- type Bus
- func (b *Bus) Clear() error
- func (b *Bus) Errorf(format string, args ...any)
- func (b *Bus) History() ([]notify.Notification, error)
- func (b *Bus) Infof(format string, args ...any)
- func (b *Bus) Publish(n notify.Notification)
- func (b *Bus) Subscribe(fn Subscriber)
- func (b *Bus) Warnf(format string, args ...any)
- type Subscriber
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 is a synchronous in-process notification bus. It dispatches notifications to subscribers inline and persists them to a Store. The Bus is safe for use from the Bubble Tea Update loop (single-threaded).
func NewBus ¶
NewBus creates a notification bus backed by the given store. If store is nil, notifications are dispatched to subscribers but not persisted.
func (*Bus) History ¶
func (b *Bus) History() ([]notify.Notification, error)
History returns all persisted notifications (newest first). Returns nil if no store is configured.
func (*Bus) Publish ¶
func (b *Bus) Publish(n notify.Notification)
Publish dispatches a notification to all subscribers and persists it to the store.
func (*Bus) Subscribe ¶
func (b *Bus) Subscribe(fn Subscriber)
Subscribe registers a callback that will be invoked on every Publish.
type Subscriber ¶
type Subscriber func(notify.Notification)
Subscriber is a callback invoked when a notification is published.