event

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EnvPublishAuditEventsKey = "FLOGO_PUBLISH_AUDIT_EVENTS"
)

Variables

This section is empty.

Functions

func HasListener

func HasListener(eventType string) bool

func Post

func Post(eventType string, event interface{})

Puts event with given type and data on the channel

func PublishEnabled

func PublishEnabled() bool

func RegisterListener

func RegisterListener(name string, listener Listener, eventTypes []string) error

Registers listener for given event types

func UnRegisterListener

func UnRegisterListener(name string, eventTypes []string)

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

Types

type Context

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

Context is a wrapper over specific event

func (*Context) GetEvent

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

Returns wrapped event data

func (*Context) GetEventType

func (ec *Context) GetEventType() string

Returns event type

type Emitter

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

func (*Emitter) HasListeners

func (te *Emitter) HasListeners() bool

func (*Emitter) Publish

func (te *Emitter) Publish(evtCtx *Context)

func (*Emitter) RegisterListener

func (te *Emitter) RegisterListener(name string, listener Listener) error

func (*Emitter) UnRegisterListener

func (te *Emitter) UnRegisterListener(name string) error

type Listener

type Listener interface {
	// Called when matching event occurs
	HandleEvent(*Context) error
}

Jump to

Keyboard shortcuts

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