events

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Manager

type Manager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Manager manages event listeners.

func NewManager

func NewManager() *Manager

NewManager returns a new Manager context.

func (*Manager) Emit

func (e *Manager) Emit(event string, data interface{})

Emit emits an event by passing it to all channels that have been registered to listen for the event.

func (*Manager) Register

func (e *Manager) Register(event string, listener chan interface{})

Register registers an event listener (channel) to listen for the provided event type.

Jump to

Keyboard shortcuts

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