observer

package
v0.0.0-...-0a60d77 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 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 Observer

type Observer interface {
	Notify(string)
}

Observer interface declares the method to notify all subscribers

type Publisher

type Publisher struct {
	ObserversList []Observer
}

Publisher contains a list of observer to spread an message

func (*Publisher) AddObserver

func (p *Publisher) AddObserver(o Observer)

AddObserver adds an observer into ObserversList

func (*Publisher) NotifyObservers

func (p *Publisher) NotifyObservers(s string)

NotifyObservers notifies all observers about a message

func (*Publisher) RemoveObserver

func (p *Publisher) RemoveObserver(o Observer)

RemoveObserver removes an observer from ObserversList

Jump to

Keyboard shortcuts

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