event

package
v0.0.27 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	TopicSubscribers map[string][]func(data interface{})
}

Bus provides the low-level transport layer for events.

func NewBus

func NewBus() *Bus

NewBus creates a Bus and returns its pointer.

func (*Bus) Publish

func (b *Bus) Publish(topic string, data interface{})

Publish sends data in context of a specific topic to all registered functions.

func (*Bus) Subscribe

func (b *Bus) Subscribe(topic string, fn func(data interface{}))

Subscribe registers a function to a specific topic.

Jump to

Keyboard shortcuts

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