files

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	Watcher      *fsnotify.Watcher
	WatchedFiles []string
	// contains filtered or unexported fields
}

Watcher encapsulates file watch and configuration, abstracting form the underlying file watch provider

func NewFileWatcher

func NewFileWatcher() *Watcher

NewFileWatcher creates Watcher

func (*Watcher) AddToWatch

func (w *Watcher) AddToWatch(files ...string) error

AddToWatch adds files to a WatchedFiles list monitored by this webhook's Watcher. The Watcher is created on demand if it's nil when the operation is invoked.

func (*Watcher) Watch

func (w *Watcher) Watch(stop <-chan struct{}, eventHandler func() error) error

Watch starts monitoring WatchedFiles, until a signal is received on its stop channel. If WatchedFiles or Watcher are not initialized, Watch returns immediately. The eventHandler function is invoked upon Modify/Create file events raised by the watched files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL