gg_events

package
v0.2.84 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: BSD-3-Clause Imports: 5 Imported by: 36

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, remove 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 emitter into 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) EmitAsyncOnce added in v0.2.77

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

func (*Emitter) EmitOnce added in v0.2.77

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

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) Publish added in v0.2.78

func (instance *Emitter) Publish(channel interface{}, async, once bool, topic string, args ...interface{}) *Emitter

func (*Emitter) Subscribe added in v0.2.78

func (instance *Emitter) Subscribe(channel interface{}, topic 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

func (*Emitter) TriggerOnce added in v0.2.77

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

func (*Emitter) Unsubscribe added in v0.2.78

func (instance *Emitter) Unsubscribe(channel interface{}, topic string, callback ...func(event *Event)) *Emitter

type EmitterListeners

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

func NewListeners

func NewListeners(emitter *Emitter) (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

func (*EventsHelper) TopicId added in v0.2.79

func (instance *EventsHelper) TopicId(sender interface{}, eventName string) string

Jump to

Keyboard shortcuts

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