package
Version:
v0.0.27
Opens a new window with list of versions in this module.
Published: Sep 7, 2020
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Bus struct {
TopicSubscribers map[string][]func(data interface{})
}
Bus provides the low-level transport layer for events.
NewBus creates a Bus and returns its pointer.
func (b *Bus) Publish(topic string, data interface{})
Publish sends data in context of a specific topic to all registered functions.
func (b *Bus) Subscribe(topic string, fn func(data interface{}))
Subscribe registers a function to a specific topic.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.