trigger

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEvents

func NewEvents(names []string, cb func(*Event)) error

NewEvents just wraps the NewEvent for multipe events and executes an callback for each of the events. this way we can stick to a more generic solution for a couple of events

func ResetAllEvents

func ResetAllEvents()

func ResetAllListener

func ResetAllListener()

func UpdateEvents

func UpdateEvents() error

Types

type Event

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

func GetEvent

func GetEvent(name string) (*Event, error)

func NewEvent

func NewEvent(name string) (*Event, error)

NewEvent creates a new Event and register it

func (*Event) AddListener

func (event *Event) AddListener(lst ...Listener) error

AddListener adds listener to the event

func (*Event) ClearListener

func (event *Event) ClearListener() error

func (*Event) GetName

func (event *Event) GetName() string

GetName just returns the name of the event

func (*Event) Send

func (event *Event) Send()

Send calls any assigned callback

func (*Event) SetArguments

func (event *Event) SetArguments(args ...interface{}) error

SetArguments adds or changes the arguments for the event

type Listener

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

func (Listener) Trigger

func (li Listener) Trigger(any []interface{})

type ListenerContainer

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

func NewListener

func NewListener(name string, calbck func(any ...interface{})) *ListenerContainer

func (*ListenerContainer) RegisterToEvent

func (trig *ListenerContainer) RegisterToEvent(eventName string)

Jump to

Keyboard shortcuts

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