notify

package
v0.31.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 6 Imported by: 0

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 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

func NewBus(store notify.Store) *Bus

NewBus creates a notification bus backed by the given store. If store is nil, notifications are dispatched to subscribers but not persisted.

func (*Bus) Clear

func (b *Bus) Clear() error

Clear deletes all persisted notifications.

func (*Bus) Errorf

func (b *Bus) Errorf(format string, args ...any)

Errorf publishes an error-level notification.

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) Infof

func (b *Bus) Infof(format string, args ...any)

Infof publishes an info-level notification.

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.

func (*Bus) Warnf

func (b *Bus) Warnf(format string, args ...any)

Warnf publishes a warning-level notification.

type Subscriber

type Subscriber func(notify.Notification)

Subscriber is a callback invoked when a notification is published.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL