dispatcher

package
v0.0.0-...-9821454 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Channels map[string]*Channel

Channels keep a list of created channels. Just for info

Functions

This section is empty.

Types

type Callback

type Callback func(eventname string, p interface{})

Callback is the function prototype Subscribers have to implement

type Channel

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

Channel is the place to register to or to broadcast events

func CreateChannel

func CreateChannel(name string) (*Channel, error)

CreateChannel creates and init a channel

func (*Channel) Init

func (c *Channel) Init()

Init initialize the channel map

func (*Channel) Publish

func (c *Channel) Publish(eventname string, payload interface{})

Publish send an event to subscribers

func (*Channel) Subscribe

func (c *Channel) Subscribe(eventname string, call Callback)

Subscribe : listen to events

Jump to

Keyboard shortcuts

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