input

package
v0.0.0-...-48aa4a7 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModNone    = iota
	ModShift   // shift key
	ModOption  // option key
	ModControl // control key
	ModCommand // command key
)

These are key modifiers. Note that they represent a real keyboard you'd use today, not a virtual keyboard from any emulated device.

View Source
const (
	KeyNone rune = 0
)

Variables

This section is empty.

Functions

func Listen

func Listen(listen EventListener)

Listen registers an EventListener and starts a loop in a goroutine, which listens for new events (via PushEvent) and calls the listen function with them. Alternatively, if a shutdown event is received, it ends.

func PushEvent

func PushEvent(e Event)

PushEvent adds a new event to the event channel, which something else can listen for and act on.

func Shutdown

func Shutdown()

Shutdown sends a message to the shutdown channel, which would end any Listen goroutine.

Types

type Event

type Event struct {
	Key      rune
	Modifier int
}

An Event is a record of something that happened with user input.

type EventListener

type EventListener func(e Event)

An EventListener is a function which receives an event

Jump to

Keyboard shortcuts

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