patterns

package
v0.0.0-...-736f05d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 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 Observable

type Observable interface {
	AddObserver(Observer)
	RemoveObserver(Observer)
	NotifyAll(interface{})
}

type Observer

type Observer interface {
	Notify(event interface{})
}

type ObserverSet

type ObserverSet map[Observer]struct{}

type SimpleObservable

type SimpleObservable struct {
	sync.RWMutex
	Observers ObserverSet
}

func NewSimpleObservable

func NewSimpleObservable() *SimpleObservable

func (*SimpleObservable) AddObserver

func (o *SimpleObservable) AddObserver(observer Observer)

func (*SimpleObservable) NotifyAll

func (o *SimpleObservable) NotifyAll(event interface{})

func (*SimpleObservable) RemoveObserver

func (o *SimpleObservable) RemoveObserver(observer Observer)

Jump to

Keyboard shortcuts

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