reload

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 7 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 {
	// contains filtered or unexported fields
}

Watcher watches a file or directory for changes and calls onChange when a relevant file is modified, with debouncing.

func NewWatcher

func NewWatcher(path string, extensions []string, onChange func()) (*Watcher, error)

NewWatcher creates a new file watcher. If extensions is nil or empty, all file changes are reported.

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

Start blocks and watches for file changes until the context is cancelled. It debounces rapid changes with a 100ms window.

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop closes the underlying fsnotify watcher.

Jump to

Keyboard shortcuts

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