listener

package
v1.8.12 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Example
eventListener := New()

ch := make(chan string)
eventListener.Add("eventname", ch)
for eventdata := range ch {
	fmt.Println(eventdata + " world")
}

eventListener.Emit("eventname", "hello")
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener interface {
	SetLimit(eventName string, limit time.Duration)
	ProvideChannel(eventName string) <-chan string
	Add(eventName string, channel chan<- string)
	Remove(eventName string, channel chan<- string)
	Emit(eventName string, data string)
	SetBuffer(eventName string)
	RetryEmit(eventName string)
}

Listener has a list of channels watching for updates.

func New

func New() Listener

New returns a new Listener which initially has no topics.

Jump to

Keyboard shortcuts

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