eventbus

package
v0.0.0-...-537864d Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

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

EventBus manages event subscriptions and publications

func New

func New() *EventBus

New creates a new EventBus

func (*EventBus) Publish

func (eb *EventBus) Publish(event events.Event)

Publish sends an event to all subscribed handlers

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(eventType events.EventType, handler EventHandler)

Subscribe registers a handler for a specific event type

func (*EventBus) Unsubscribe

func (eb *EventBus) Unsubscribe(eventType events.EventType, handler EventHandler)

Unsubscribe removes a handler for a specific event type

type EventHandler

type EventHandler func(event events.Event)

EventHandler is a function that handles an event

Jump to

Keyboard shortcuts

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