evreg

package
v2.0.0-...-7f6935a Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	F func(ev interface{})
}

type Regist

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

func (*Regist) Unregister

func (reg *Regist) Unregister()

type Register

type Register struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

The zero register is empty and ready for use.

func (*Register) Add

func (reg *Register) Add(evId int, fn func(interface{})) *Regist

Remove is done via *Regist.Unregister().

func (*Register) AddCallback

func (reg *Register) AddCallback(evId int, cb *Callback) *Regist

func (*Register) NCallbacks

func (reg *Register) NCallbacks(evId int) int

Number of registered callbacks for an event id.

func (*Register) RemoveCallback

func (reg *Register) RemoveCallback(evId int, cb *Callback)

func (*Register) RunCallbacks

func (reg *Register) RunCallbacks(evId int, ev interface{}) int

Returns number of callbacks done.

type Unregister

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

Utility to unregister big number of regists.

func (*Unregister) Add

func (unr *Unregister) Add(u ...*Regist)

func (*Unregister) UnregisterAll

func (unr *Unregister) UnregisterAll()

Jump to

Keyboard shortcuts

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