1
0
Fork 0

Add init helper

This commit is contained in:
Gregory Eremin 2015-08-29 20:36:27 +03:00
parent abe48658a3
commit f18e61449a
1 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@ var (
configFile string
callbacks = make(map[string][]func(oldVal, newVal interface{}))
initialized bool
initFunc func()
)
// 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
// a field changes.
func OnChange(field string, fun func(oldVal, newVal interface{})) {