events

package
v0.0.0-...-0653a19 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package events allows for the registering and receiving of events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

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

Events maintains a mapping of unique id and channels so goroutines can register and receive events.

func New

func New() *Events

New constructs an events for registering and receiving events.

func (*Events) Acquire

func (evt *Events) Acquire(id string) chan string

Acquire takes a unique id and returns a channel that can be used to receive events.

func (*Events) Release

func (evt *Events) Release(id string) error

Release closes and removes the channel that was provided by the call to Acquire.

func (*Events) Send

func (evt *Events) Send(s string)

Send signals a message to ever registered channel. Send will not block waiting for a receiver on any given channel.

func (*Events) Shutdown

func (evt *Events) Shutdown()

Shutdown closes and removes all channels that were provided by the call to Acquire.

Jump to

Keyboard shortcuts

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