event

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 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 Emitter

type Emitter[T any] struct {
	Sync bool //同步执行,默认不需要
	// contains filtered or unexported fields
}

Emitter 事件监听器

func (*Emitter[T]) Clear

func (e *Emitter[T]) Clear()

Clear 取消所有监听

func (*Emitter[T]) Emit

func (e *Emitter[T]) Emit(t T)

Emit 发送消息

func (*Emitter[T]) Off

func (e *Emitter[T]) Off(id int)

Off 删除监听

func (*Emitter[T]) On

func (e *Emitter[T]) On(fn func(t T)) int

On 监听消息

func (*Emitter[T]) Once

func (e *Emitter[T]) Once(fn func(t T)) int

Once 监听消息(仅一次)

Jump to

Keyboard shortcuts

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