Documentation ¶
Index ¶
- Variables
- func AddListener(key string, callback func())
- func KnownOption(rule Option) bool
- func NotifyListeners(key string)
- func RegisterOption(key string, t Type, defaultValue interface{})
- func RegisterOptionWithEvents(key string, t Type, defaultValue interface{}, get, set Event)
- type Event
- type Option
- type Registry
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyEvent = func(value interface{}) (interface{}, error) { return value, nil }
Functions ¶
func AddListener ¶
func AddListener(key string, callback func())
AddListener adds a listener for changes to the given config key that calls the given callback function. Client code is responsible for calling NotifyListeners to signal config changes to listeners.
func KnownOption ¶
func NotifyListeners ¶
func NotifyListeners(key string)
NotifyListeners notifies listeners that the given config key has changed.
func RegisterOption ¶
Registers a config option without get/set events.
func RegisterOptionWithEvents ¶
Registers a config option with get/set events.
Types ¶
type Event ¶
type Event func(value interface{}) (interface{}, error)
Event is run when a user tries to set or get a config value via `state config`
Click to show internal directories.
Click to hide internal directories.