emitter

package
v0.0.0-...-169a2f2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

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

Emitter handles event subscriptions

func New

func New() *Emitter

New creates a new Emitter

func (*Emitter) Emit

func (e *Emitter) Emit(event Event)

Emit sends new event to all subscriptions

func (*Emitter) Subscribe

func (e *Emitter) Subscribe(buffer int) *Subscription

Subscribe create a new subscription

type Event

type Event interface{}

Event type

type NewEventFunc

type NewEventFunc func(e Event)

NewEventFunc type

type Subscription

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

Subscription type

func (*Subscription) Events

func (s *Subscription) Events() <-chan Event

Listen invokes given function for each event

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe()

Unsubscribe stops getting new events

Jump to

Keyboard shortcuts

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