event

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: BSD-3-Clause Imports: 6 Imported by: 8 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasListener

func HasListener(eventType string) bool

func PostEvent

func PostEvent(eType string, event interface{})

TODO channel to be passed to actions Puts event with given type and data on the channel

func RegisterEventListener

func RegisterEventListener(evtListener EventListener, eventTypes []string) error

Registers listener for given event types

func UnRegisterEventListener

func UnRegisterEventListener(name string, eventTypes []string)

Unregister event listener for given event types . To unregister from all event types, set eventTypes to nil

Types

type EventContext

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

EventContext is a wrapper over specific event

func (*EventContext) GetEvent

func (ec *EventContext) GetEvent() interface{}

Returns wrapped event data

func (*EventContext) GetType

func (ec *EventContext) GetType() string

Returns event type

type EventListener

type EventListener interface {
	// Returns name of the listener
	Name() string

	// Called when matching event occurs
	HandleEvent(*EventContext) error
}

Jump to

Keyboard shortcuts

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