gg_events

package
v0.2.58 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: BSD-3-Clause Imports: 5 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debouncer

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

func (*Debouncer) Init

func (instance *Debouncer) Init(emitter *Emitter, wait time.Duration, eventName string, async bool, args ...interface{})

type Emitter

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

func NewEmitterInstance

func NewEmitterInstance(waitTime time.Duration, payload ...interface{}) (instance *Emitter)

func (*Emitter) Clear

func (instance *Emitter) Clear()

func (*Emitter) Debounce

func (instance *Emitter) Debounce(waitTime time.Duration) *Emitter

Debounce transform a standard event emitterinto a debounced one

func (*Emitter) Emit

func (instance *Emitter) Emit(eventName string, args ...interface{}) *Emitter

Emit @Deprecated use Trigger method instead

func (*Emitter) EmitAsync

func (instance *Emitter) EmitAsync(eventName string, args ...interface{}) *Emitter

EmitAsync @Deprecated use Trigger method instead

func (*Emitter) Has

func (instance *Emitter) Has(eventName string) bool

func (*Emitter) Off

func (instance *Emitter) Off(eventName string, callback ...func(event *Event)) *Emitter

func (*Emitter) On

func (instance *Emitter) On(eventName string, callback func(event *Event)) *Emitter

func (*Emitter) Trigger

func (instance *Emitter) Trigger(async bool, eventName string, args ...interface{}) *Emitter

Trigger emit an event synch or async

type EmitterListeners

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

func NewListeners

func NewListeners() (instance *EmitterListeners)

func (*EmitterListeners) Clear

func (instance *EmitterListeners) Clear()

func (*EmitterListeners) GetListeners

func (instance *EmitterListeners) GetListeners() (response map[string][]EventCallback)

func (*EmitterListeners) Has

func (instance *EmitterListeners) Has(eventName string) bool

func (*EmitterListeners) Off

func (instance *EmitterListeners) Off(eventName string, callback ...func(event *Event))

func (*EmitterListeners) On

func (instance *EmitterListeners) On(eventName string, callback EventCallback) (response map[string][]EventCallback)

type Event

type Event struct {
	Name      string
	Arguments []interface{}
	Payload   interface{}
	Async     bool
}

func NewEvent

func NewEvent(async bool, eventName string, payload interface{}, args ...interface{}) (event *Event)

func (*Event) Argument

func (instance *Event) Argument(index int) interface{}

func (*Event) ArgumentAsBytes

func (instance *Event) ArgumentAsBytes(index int) []byte

func (*Event) ArgumentAsError

func (instance *Event) ArgumentAsError(index int) error

func (*Event) ArgumentAsInt

func (instance *Event) ArgumentAsInt(index int) int

func (*Event) ArgumentAsString

func (instance *Event) ArgumentAsString(index int) string

func (*Event) ArgumentsInterface

func (instance *Event) ArgumentsInterface() interface{}

type EventCallback

type EventCallback func(event *Event)

type EventsHelper

type EventsHelper struct {
}
var Events *EventsHelper

func (*EventsHelper) NewDebounceEmitter

func (instance *EventsHelper) NewDebounceEmitter(waitTime time.Duration, payload ...interface{}) *Emitter

func (*EventsHelper) NewEmitter

func (instance *EventsHelper) NewEmitter(payload ...interface{}) *Emitter

Jump to

Keyboard shortcuts

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