utils

package
v0.0.0-...-7f98e96 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observable

type Observable interface {
	// AddObserver adds a new callback to an observable value.
	AddObserver(observer func(data interface{})) ObserverManager
	// Notify executes all callbacks with provided data.
	Notify(data interface{})
}

Observable allows one to attach an callback which will be called when someone calls the Notify method. It might be for example a change of some property's value.

func NewObservable

func NewObservable() Observable

NewObservable creates an default instance of the Observable type.

func NewThreadSafeObservable

func NewThreadSafeObservable() Observable

NewThreadSafeObservable creates an instance of the Observable type that can be used safely by multiple go-routines.

type ObserverManager

type ObserverManager interface {
	// RemoveObserver removes underlying callback from its Observable value.
	RemoveObserver()
}

ObserverManager allows one to remove its callback from its underlying Observable instance.

Jump to

Keyboard shortcuts

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