events

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus added in v1.5.4

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

Bus represents an Event Bus.

func NewBus added in v1.5.4

func NewBus() *Bus

NewBus returns a new empty Event Bus.

func (*Bus) Destroy added in v1.5.4

func (b *Bus) Destroy()

Destroy destroys the Event Bus by unregistering and closing all listeners.

func (*Bus) Off added in v1.5.4

func (b *Bus) Off(listener Listener, topics ...string)

Off unregisters a listener from the specified topics on the Bus.

func (*Bus) On added in v1.5.4

func (b *Bus) On(listener Listener, topics ...string)

On registers a listener to the specified topics on the Bus.

func (*Bus) Publish added in v1.5.4

func (b *Bus) Publish(topic string, data interface{})

Publish publishes a message to the Bus.

type Event

type Event struct {
	Topic string
	Data  interface{}
}

Event represents an Event sent over a Bus.

type Listener added in v1.5.4

type Listener chan Event

Jump to

Keyboard shortcuts

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