ebus

package
v0.0.0-...-680e691 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(ctx context.Context, ev Event)

Dispatch 触发事件,阻塞调用

func Listen

func Listen(ev string, cb Callback, async bool)

Listen 注册事件回调,async标记同步执行还是异步执行

func Remove

func Remove(ev string, cb Callback)

Remove 删除事件回调

Types

type Bus

type Bus interface {
	Listen(ev string, cb Callback, async bool)
	Remove(ev string, cb Callback)
	Dispatch(ctx context.Context, ev Event)
}

Bus 事件总线

type Callback

type Callback func(ctx context.Context, ev Event)

Callback 事件回调

type Event

type Event interface {
	Name() string
}

Event 事件接口

Jump to

Keyboard shortcuts

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