events

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen[Arg any](e *Event[Arg]) <-chan Arg

Types

type Event

type Event[Arg any] struct {
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent[Arg any]() *Event[Arg]

func (*Event[Arg]) Emit

func (e *Event[Arg]) Emit(arg Arg, wg *sync.WaitGroup)

func (*Event[Arg]) EmitOne

func (e *Event[Arg]) EmitOne(arg Arg, wg *sync.WaitGroup)

func (*Event[Arg]) On

func (e *Event[Arg]) On(cb func(Arg)) EventHandle

func (*Event[Arg]) Signal

func (e *Event[Arg]) Signal(wg *sync.WaitGroup)

func (*Event[Arg]) SignalOne

func (e *Event[Arg]) SignalOne(wg *sync.WaitGroup)

type EventHandle

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

func (EventHandle) Off

func (h EventHandle) Off()

type Listener

type Listener[Arg any] struct {
	C <-chan Arg
	// contains filtered or unexported fields
}

func NewListener

func NewListener[Arg any](e *Event[Arg]) (res *Listener[Arg])

func (*Listener[Arg]) Stop

func (l *Listener[Arg]) Stop()

type VoidEvent

type VoidEvent = Event[struct{}]

func NewVoidEvent

func NewVoidEvent() *VoidEvent

type VoidListener

type VoidListener = Listener[struct{}]

Jump to

Keyboard shortcuts

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