pubsub

package
v0.0.0-...-897d125 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCapacity = 1

DefaultCapacity for the Pubsub

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

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

func New

func New(capacity ...int) *PubSub

New Pubsub with capacity size. If capacity is not given, use default insteadly.

func (*PubSub) Pub

func (ps *PubSub) Pub(events ...event.Event)

publish Event to corresponding subscribers.

func (*PubSub) Shutdown

func (ps *PubSub) Shutdown()

func (*PubSub) Sub

func (ps *PubSub) Sub(typ ...event.Type) chan interface{}

subscribes specified EventType and return message channel.

func (*PubSub) Unsub

func (ps *PubSub) Unsub(ch chan interface{})

unsubscribes specified channel which is gotten by previous Sub().

Jump to

Keyboard shortcuts

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