ebus

package
v0.0.0-...-012d1c6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(topic string)

Clear 清空所有

func Emit

func Emit(ev IEvent, opts ...Option)

Emit 调用函数

func Len

func Len(topic string) int

func Listen

func Listen(callback interface{}, opts ...Option) uint

Listen 注册监听函数,原型必须是func(ev XXEvent)

func Remove

func Remove(topic string, id uint)

Remove 注销

Types

type Callback

type Callback func(event IEvent)

type IEvent

type IEvent interface {
}

type IEventBus

type IEventBus interface {
	Len(topic string) int
	Listen(topic string, once bool, priority int, cb Callback) uint
	Remove(topic string, id uint)
	Clear(topic string)
	Emit(topic string, event IEvent)
}

func New

func New() IEventBus

type Option

type Option func(*Options)

func Once

func Once() Option

func Priority

func Priority(lv int) Option

func Topic

func Topic(t string) Option

type Options

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

Jump to

Keyboard shortcuts

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