event

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: BSD-3-Clause Imports: 6 Imported by: 8

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