astievent

package
v1.3.1-0...-4e0822b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher represents an object that can dispatch simple events (name + payload)

func NewDispatcher

func NewDispatcher() *Dispatcher

NewDispatcher creates a new dispatcher

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(name string, payload interface{})

Dispatch dispatches a payload for a specific name

func (*Dispatcher) On

func (d *Dispatcher) On(name string, h EventHandler)

On adds an event handler for a specific name

func (*Dispatcher) Reset

func (d *Dispatcher) Reset()

Reset resets the dispatcher

func (*Dispatcher) Start

func (d *Dispatcher) Start(ctx context.Context)

Start starts the dispatcher. It is blocking

func (*Dispatcher) Stop

func (d *Dispatcher) Stop()

Stop stops the dispatcher

type EventHandler

type EventHandler func(payload interface{})

EventHandler represents a function that can handler an event's payload

Jump to

Keyboard shortcuts

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