event

package
v0.0.0-...-82b4563 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package event is the event handler

Index

Constants

This section is empty.

Variables

View Source
var ErrDontForward = errors.New("dont forward")

ErrDontForward will stop the event from being forwarded to other handlers, including anything handlers.

Functions

This section is empty.

Types

type Anything

type Anything struct {
	Val any
}

type HandlerDoneErr

type HandlerDoneErr struct {
	Return error
}

HandlerDoneErr will stop the event loop and return the error if provided.

func (HandlerDoneErr) Error

func (e HandlerDoneErr) Error() string

func (HandlerDoneErr) Unwrap

func (e HandlerDoneErr) Unwrap() error

type Loop

type Loop struct {
	HandlerFunctions map[reflect.Type][]reflect.Value
	Handlers         []any
	HandlerIndex     int
}

func (*Loop) FindHandlers

func (l *Loop) FindHandlers()

FindHandlers initializes and populates the HandlerFunctions map by reflecting over methods of registered handlers.

func (*Loop) Fire

func (l *Loop) Fire(event any) (err error)

Fire dispatches the provided event to all appropriate handlers and invokes fallback handlers if the event is unhandled.

func (*Loop) FireFound

func (l *Loop) FireFound(event any) (found bool, err error)

FireFound triggers all handlers registered for the specified event type and returns if handlers were found or an error occurred.

func (*Loop) Start

func (l *Loop) Start() (err error)

type OnStart

type OnStart struct{}

type Tick

type Tick struct{}

type Unhandled

type Unhandled struct {
	Val any
}

Jump to

Keyboard shortcuts

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