events

package
v1.15.7 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: CC0-1.0, MIT Imports: 4 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Debug enables debug logging.

Functions

func ProcessAllEvents

func ProcessAllEvents(w donburi.World)

ProcessAllEvents processes all events.

Types

type EventType

type EventType[T any] struct {
	// contains filtered or unexported fields
}

Event represents kind of event. It is used to subscribe and publish events.

func NewEventType

func NewEventType[T any]() *EventType[T]

NewEventType creates a new event type.

func (*EventType[T]) ProcessEvents

func (e *EventType[T]) ProcessEvents(w donburi.World)

ProcessEvents processes events.

func (*EventType[T]) Publish

func (e *EventType[T]) Publish(w donburi.World, event T)

Publish publishes an event.

func (*EventType[T]) Subscribe added in v1.2.22

func (e *EventType[T]) Subscribe(w donburi.World, subscriber Subscriber[T])

Subscribe registers a subscriber for the event.

func (*EventType[T]) Unsubscribe added in v1.3.3

func (e *EventType[T]) Unsubscribe(w donburi.World, subscriber Subscriber[T])

Unsubscribe removes a subscriber for the event.

type Subscriber

type Subscriber[T any] func(w donburi.World, event T)

Subscriber is a function that handles an event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳