Add init helper
This commit is contained in:
		
							parent
							
								
									abe48658a3
								
							
						
					
					
						commit
						f18e61449a
					
				| @ -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{})) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user