eventbus

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: LGPL-3.0 Imports: 1 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus interface {
	BusSubscriber
	BusPublisher
}

Bus allows to subscribe/unsubscribe to external events and publish own events

func New

func New() Bus

New returns new event bus

type BusPublisher

type BusPublisher interface {
	Publish(event Event)
}

BusPublisher allows to publish own events

type BusSubscriber

type BusSubscriber interface {
	Subscribe(eventID EventID, cb EventHandler) Subscription
	Unsubscribe(id Subscription)
}

BusSubscriber allows to subscribe/unsubscribe own event handlers

type Event

type Event interface {
	EventID() EventID
}

Event must be implemented by anything that can be published

type EventHandler

type EventHandler func(event Event)

EventHandler is function that can be subscribed to the event

type EventID

type EventID string

EventID identifies events topic.

type Subscription

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

Subscription represents active event subscription

Jump to

Keyboard shortcuts

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