var WatchFilter = func(c *Controller, fc []Filter) {
    if MainWatcher != nil {
        err := MainWatcher.Notify()
        if err != nil {
            c.Result = c.RenderError(err)
    fc[0](c, fc[1:])

type DiscerningListener

type DiscerningListener interface {
    WatchDir(info os.FileInfo) bool
    WatchFile(basename string) bool

DiscerningListener allows the receiver to selectively watch files.

type Listener

type Listener interface {
    // Refresh is invoked by the watcher on relevant filesystem events.
    // If the listener returns an error, it is served to the user on the current request.
    Refresh() *Error

Listener is an interface for receivers of filesystem events.

type Watcher

type Watcher struct {
    // contains filtered or unexported fields

Watcher allows listeners to register to be notified of changes under a given directory.

func NewWatcher

func NewWatcher() *Watcher

func (*Watcher) Listen

func (w *Watcher) Listen(listener Listener, roots ...string)

Listen registers for events within the given root directories (recursively).

func (*Watcher) Notify

func (w *Watcher) Notify() *Error

Notify causes the watcher to forward any change events to listeners. It returns the first (if any) error returned.