manager

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElementManager

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

ElementManager is a helper to manage different Elements and their key handlers, so that only the key handlers of the current element are executed

func NewElementManager

func NewElementManager() *ElementManager

NewElementManager creates a new ElementManager

func (*ElementManager) Broadcast

func (eh *ElementManager) Broadcast(event EventMsg)

Broadcast sends an event to all listeners

func (*ElementManager) SendTo

func (eh *ElementManager) SendTo(element tview.Identifier, event EventMsg)

SendTo sends an event to a specific element

func (*ElementManager) Subscribe

func (eh *ElementManager) Subscribe(element tview.Identifier) chan EventMsg

Subscribe subscribes to events from a specific element

func (*ElementManager) Unsubscribe

func (eh *ElementManager) Unsubscribe(element tview.Identifier, listener chan EventMsg)

Unsubscribe unsubscribes from events from a specific element

type EventMsg

type EventMsg struct {
	*tcell.EventKey
	Sender  tview.Identifier
	Message Message
}

EventMsg is a wrapper for tcell.EventKey that also contains the sender of the event

type Message

type Message struct {
	Type MessageType
	Data interface{}
}

Messages is a list of messages that can be sent to the manager

type MessageType

type MessageType string
const (
	FocusChanged           MessageType = "focus_changed"
	StyleChanged           MessageType = "style_changed"
	UpdateAutocompleteKeys MessageType = "update_autocomplete"
	UpdateQueryBar         MessageType = "update_query_bar"
)

Jump to

Keyboard shortcuts

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