event

package
Version: v1.0.0-beta.23 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(data interface{})

type DiscardEventMachine

type DiscardEventMachine struct{}

DiscardEventMachine is an EventMachine which discards all emits.

func (*DiscardEventMachine) Emit

func (*DiscardEventMachine) Emit(data interface{}, event Event)

func (*DiscardEventMachine) RegisterListener

func (*DiscardEventMachine) RegisterListener(cb Callback, event Event) uint64

func (*DiscardEventMachine) UnregisterListener

func (*DiscardEventMachine) UnregisterListener(id uint64) error

type Event

type Event int32

Event is an event emitted by the account or account plugin.

const (
	// emitted when a transfer was broadcasted.
	EventSentTransfer Event = iota
	// emitted when input selection is executed.
	EventDoingInputSelection
	// emitted when a new transfer is being prepared.
	EventPreparingTransfer
	// emitted when transactions to approve are fetched.
	EventGettingTransactionsToApprove
	// emitted when Proof-of-Work is being done.
	EventAttachingToTangle
	// emitted for internal errors of all kinds.
	EventError
	// emitted when the account got shutdown cleanly.
	EventShutdown
)

type EventMachine

type EventMachine interface {
	// Emit emits the given event with the given data.
	Emit(data interface{}, event Event)
	// Register registers the given channel to receive values for the given event.
	RegisterListener(cb Callback, event Event) uint64
	// Unregister unregisters the given channel to receive events.
	UnregisterListener(uint64) error
}

EventMachine defines an object which registers listeners and emits events.

func NewEventMachine

func NewEventMachine() EventMachine

NewEventMachine creates a new EventMachine.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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