Add init helper
This commit is contained in:
parent
abe48658a3
commit
f18e61449a
|
@ -21,6 +21,7 @@ var (
|
||||||
configFile string
|
configFile string
|
||||||
callbacks = make(map[string][]func(oldVal, newVal interface{}))
|
callbacks = make(map[string][]func(oldVal, newVal interface{}))
|
||||||
initialized bool
|
initialized bool
|
||||||
|
initFunc func()
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetupFlags sets up Confection configuration flags.
|
// SetupFlags sets up Confection configuration flags.
|
||||||
|
@ -96,6 +97,12 @@ func HandleFSEvents() {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OnLoad sets up a callback function that would be called once configuration
|
||||||
|
// is loaded for the first time.
|
||||||
|
func OnLoad(fun func()) {
|
||||||
|
initFunc = fun
|
||||||
|
}
|
||||||
|
|
||||||
// OnChange adds a callback function that is triggered every time a value of
|
// OnChange adds a callback function that is triggered every time a value of
|
||||||
// a field changes.
|
// a field changes.
|
||||||
func OnChange(field string, fun func(oldVal, newVal interface{})) {
|
func OnChange(field string, fun func(oldVal, newVal interface{})) {
|
||||||
|
|
Loading…
Reference in New Issue