events

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandEventBus

type CommandEventBus struct {
	// contains filtered or unexported fields
}

CommandEventBus is an event bus for command-level internal communication. It is separate from the backend event bus and handles command-specific events. Unlike the backend EventBus, this supports unsubscribe, subscribe-once, and ID-based management.

func NewCommandEventBus

func NewCommandEventBus() *CommandEventBus

NewCommandEventBus creates a new command-level event bus

func (*CommandEventBus) Clear

func (bus *CommandEventBus) Clear()

Clear removes all subscribers

func (*CommandEventBus) Emit

func (bus *CommandEventBus) Emit(eventType string, event interface{})

Emit sends an event to all subscribers of the given event type. Handlers are called asynchronously in separate goroutines.

func (*CommandEventBus) HasPendingEvents

func (bus *CommandEventBus) HasPendingEvents() bool

HasPendingEvents returns true if there are event handlers currently running

func (*CommandEventBus) Subscribe

func (bus *CommandEventBus) Subscribe(eventType string, handler func(interface{})) func()

Subscribe registers a handler for a specific event type. Returns an unsubscribe function.

func (*CommandEventBus) SubscribeOnce

func (bus *CommandEventBus) SubscribeOnce(eventType string, handler func(interface{})) func()

SubscribeOnce registers a handler that will only be called once

func (*CommandEventBus) WaitForPendingEvents

func (bus *CommandEventBus) WaitForPendingEvents()

WaitForPendingEvents blocks until all currently pending event handlers complete

Jump to

Keyboard shortcuts

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