event

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalSyncEvent

func GlobalSyncEvent(param interface{})

func PublishSyncEvent added in v0.0.3

func PublishSyncEvent(name string, message Message)

func RegisterSyncEvent

func RegisterSyncEvent(name string, callback func(Message))

Register the events, providing the event name and the callback function

Types

type AsyncEvent added in v0.0.4

type AsyncEvent interface {
	NewAsyncEvent(topic string)
	RegisterAsyncEvent(topic string)
	PrintDataAsyncEvent(topic string, data DataEvent)
	PublishAsyncEvent(topic string, data interface{})
}

type DataChannel

type DataChannel chan DataEvent

type DataEvent

type DataEvent struct {
	Data  interface{}
	Topic string
}

type DatachannelSlice

type DatachannelSlice []DataChannel

type Driver

type Driver struct {
}

func (*Driver) OnEvent

func (a *Driver) OnEvent(param interface{})

Add an event-processing function for function

type EventBus

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

func (*EventBus) PublishAsyncEvent

func (eb *EventBus) PublishAsyncEvent(topic string, data interface{})

func (*EventBus) SubscribeAsyncEvent

func (eb *EventBus) SubscribeAsyncEvent(topic string, ch DataChannel)

type EventFuncs

type EventFuncs struct {
}

func (*EventFuncs) NewAsyncEvent

func (e *EventFuncs) NewAsyncEvent(topic string)

func (*EventFuncs) PrintDataAsyncEvent

func (e *EventFuncs) PrintDataAsyncEvent(topic string, data DataEvent)

func (*EventFuncs) PublishAsyncEvent

func (e *EventFuncs) PublishAsyncEvent(topic string, message interface{})

func (*EventFuncs) RegisterAsyncEvent

func (e *EventFuncs) RegisterAsyncEvent(topic string, chanEvent chan DataEvent)

type Message

type Message struct {
	Type string
	Data []byte
}

type SyncEvent added in v0.0.4

type SyncEvent interface {
	OnEvent(param interface{})
	GlobalSyncEvent(param interface{})
	PublishSyncEvent(name string, message Message)
	RegisterSyncEvent(name string, callback func(Message))
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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