ev

package
v0.0.0-...-435d922 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Keystroke = iota
	Resize
	TrayMessage
	PlayerChanged
	DownloadChanged
	RequestShutdown
)

Event classes. ev.Handler passes events as integers between goroutines. These integers are not arbitrary and are selected by the caller. This allows the receiving goroutine to select which events are relevant to it using simple arithmetic and/or a switch case.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler is a multiplexer over multiple subsystems waiting for events in parallel. When an event is delivered from one subsystem, handler bounces the message to all other listening handlers.

Handler is thread safe, provided that handlers are only added in sequence and it is only ever passed by value after initialisation completes.

func NewHandler

func NewHandler() *Handler

func (Handler) Post

func (h Handler) Post(ev int)

func (*Handler) Register

func (h *Handler) Register() chan int

func (Handler) Run

func (h Handler) Run()

Jump to

Keyboard shortcuts

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