event

package
v0.0.0-...-47a16e8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: GPL-3.0 Imports: 1 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 intemediates publishers and subscribers via an event interface.

func (*Bus) Publish

func (b *Bus) Publish(t Typer)

Publish an event to all Subscribers to that type.

func (*Bus) Subscribe

func (b *Bus) Subscribe(t Type, f Subscriber) func()

Subscribe to all events of a type. Returns an Unsubscribe function.

type Subscriber

type Subscriber func(Typer)

Subscriber is anything that is subscribed to an event type.

type Type

type Type string

Type enumerates Events.

func (Type) Type

func (ty Type) Type() Type

Type implements the Typer interface, so that simple events without data can be Published.

type Typer

type Typer interface {
	Type() Type
}

Typer is an awkward thing that represents anything that provides its type.

Jump to

Keyboard shortcuts

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