Documentation
¶
Overview ¶
Package watchfiles provides a reusable utility to watch files and get notified of changes
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RemoveCallback ¶
type RemoveCallback func(filePath string)
RemoveCallback gets invoked when a watched file is modified
type UpdateCallback ¶
UpdateCallback gets invoked when a watched file is modified, or when a new file is added to a watched directory
type WatchFiles ¶
type WatchFiles struct {
// contains filtered or unexported fields
}
WatchFiles allows loading, and optionally watching files for changes.
func NewWatchFiles ¶
func NewWatchFiles(filePath string, filePattern *regexp.Regexp, updateCb UpdateCallback, removeCb RemoveCallback) (*WatchFiles, error)
NewWatchFiles is the constructor function for a Config instance
The following parameters are supported: filePath: the directory or file to open and watch. If a directory is used, all files in it are loaded updateCb: (optional) a callback that is invoked when config data files are updated, or added removeCb: (optional) a callback that is invoked when config data files are removed
func (*WatchFiles) StartWatch ¶
func (wf *WatchFiles) StartWatch() error
StartWatch loads and watches files
Click to show internal directories.
Click to hide internal directories.