Documentation ¶
Overview ¶
Package reloader provides a method to load a file whenever it changes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reloader ¶
type Reloader struct {
// contains filtered or unexported fields
}
Reloader represents an ongoing reloader task.
func New ¶
func New(filename string, dataCallback func([]byte) error, errorCallback func(error)) (*Reloader, error)
New loads the filename provided, and calls the callback. It then spawns a goroutine to check for updates to that file, calling the callback again with any new contents. The first load, and the first call to callback, are run synchronously, so it is easy for the caller to check for errors and fail fast. New will return an error if it occurs on the first load. Otherwise all errors are sent to the callback.
Click to show internal directories.
Click to hide internal directories.