events

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEvent

func NewEvent() types.EventCenter

Types

type Event

type Event struct {
	Subscribers map[types.EventType]map[types.Subscriber]types.EventFunc
	// contains filtered or unexported fields
}

func (*Event) Notify

func (e *Event) Notify(eventType types.EventType, value interface{}) (err error)

Notify subscribers that Subscribe specified event

func (*Event) NotifyAll

func (e *Event) NotifyAll() (errs []error)

Notify all event subscribers

func (*Event) NotifySubscriber

func (e *Event) NotifySubscriber(eventFunc types.EventFunc, value interface{})

func (*Event) Subscribe

func (e *Event) Subscribe(eventType types.EventType, eventFunc types.EventFunc) types.Subscriber

adds a new subscriber to Event.

func (*Event) UnSubscribe

func (e *Event) UnSubscribe(eventType types.EventType, subscriber types.Subscriber) (err error)

UnSubscribe removes the specified subscriber

func (*Event) UnSubscribeAll

func (e *Event) UnSubscribeAll()

unsubscribe all event and subscriber elegant

Jump to

Keyboard shortcuts

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