v0.0.0-...-efdff95 Latest Latest

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 4 Imported by: 0




This section is empty.


This section is empty.


func Emit

func Emit(name string, data interface{})

Emit an event

func MatchListeners

func MatchListeners(path string) []string

MatchListeners return a list of matching event names replacing * with any char and assuming a namespacing built with dots (.) eg. device_name.uu-id-val

func Off

func Off(name string, callback *Callback)

Off Removes all callbacks from an event

func On

func On(event string, callback *Callback)

On registers to an event

func RemoveListeners

func RemoveListeners(pattern string, callback *Callback)

RemoveListeners drop a list of listeners by event name


type BaseEvent

type BaseEvent struct {
	// contains filtered or unexported fields

BaseEvent contains unspecialized information about what happened

func (BaseEvent) GetData

func (e BaseEvent) GetData() interface{}

GetData return the event data

func (BaseEvent) GetName

func (e BaseEvent) GetName() string

GetName return the event name

type Callback

type Callback func(ev Event)

Callback is a function to be invoked when an event happens

func NewCallback

func NewCallback(fn func(ev Event)) *Callback

NewCallback creates a new Callback to be passed to the emitter

type Event

type Event interface {
	GetName() string
	GetData() interface{}

Event contains information about what happened

Jump to

Keyboard shortcuts

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