gg_observable

package
v0.2.53 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObservableHelper

type ObservableHelper struct {
}
var Observable *ObservableHelper

func (ObservableHelper) New

func (instance ObservableHelper) New() *ObservableObj

type ObservableObj

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

ObservableObj preserve values into a map and notify to observers any change

func NewObservable

func NewObservable() *ObservableObj

func (*ObservableObj) Fork

func (instance *ObservableObj) Fork() *ObservableObj

Fork clone data but not observers

func (*ObservableObj) Get

func (instance *ObservableObj) Get(key string) (value interface{})

func (*ObservableObj) IsAsync

func (instance *ObservableObj) IsAsync() bool

func (*ObservableObj) Observe

func (instance *ObservableObj) Observe(key string, callback ObserverCallback) *ObservableObj

func (*ObservableObj) Set

func (instance *ObservableObj) Set(key string, value interface{}) *ObservableObj

func (*ObservableObj) SetAsync

func (instance *ObservableObj) SetAsync(value bool) *ObservableObj

SetAsync enable async notifications, but do not give any warranty about execution order

func (*ObservableObj) SetKeepOrder

func (instance *ObservableObj) SetKeepOrder(value bool) *ObservableObj

SetKeepOrder ensure FIFO execution order in notification

func (*ObservableObj) String

func (instance *ObservableObj) String() string

func (*ObservableObj) ToMap

func (instance *ObservableObj) ToMap() map[string]interface{}

func (*ObservableObj) Wait

func (instance *ObservableObj) Wait()

type ObserverCallback

type ObserverCallback func(sender *ObservableObj, key string, newValue, oldValue interface{})

Jump to

Keyboard shortcuts

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