eventemitter

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventEmitter

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

func New

func New() *EventEmitter

新建事件触发器

func (*EventEmitter) AddEventListener

func (e *EventEmitter) AddEventListener(name string, listener EventListener)

添加事件监听器

func (*EventEmitter) EmitEvent

func (e *EventEmitter) EmitEvent(name string, args ...interface{}) (count int)

触发事件,触发后立即返回,不等待监听器执行完毕。 但是保证同一事件的所有监听器一定是按照顺序执行的,如果前面的监听器阻塞了则会导致后面的事件也阻塞

func (*EventEmitter) NewEventListenerChan

func (e *EventEmitter) NewEventListenerChan(name string, size int) (c chan []interface{}, remove func())

获取事件监听器的chan

func (*EventEmitter) RemoveAllEventListener

func (e *EventEmitter) RemoveAllEventListener(name string)

删除所有事件监听器

func (*EventEmitter) RemoveEventListener

func (e *EventEmitter) RemoveEventListener(name string, listener EventListener)

删除事件监听器

type EventListener

type EventListener = func(args ...interface{})

Jump to

Keyboard shortcuts

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