event

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	EventType() Type
}

Event represents an event data

type Handler

type Handler interface {
	HandleEvent(Event)
}

Handler handles event

type HandlerFunc

type HandlerFunc func(Event)

HandlerFunc wraps a function as Handler

func (HandlerFunc) HandleEvent

func (fn HandlerFunc) HandleEvent(e Event)

HandleEvent implements Handler HandleEvent method

type Manager

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

Manager manages event handlers

func NewManager

func NewManager() *Manager

NewManager creates an event manager

func (*Manager) Post

func (m *Manager) Post(e Event)

Post posts event

func (*Manager) Register

func (m *Manager) Register(t Type, h Handler)

Register registers handler by event type

type Type

type Type int64

Type represents type of event

Jump to

Keyboard shortcuts

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