watcher

package
v0.0.0-...-f3ea40d Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WatchFilesystem

func WatchFilesystem(ctx context.Context, opt WatchOptions) error

Types

type WatchOptions

type WatchOptions struct {
	// RunOnStart indicates whether to run the function on start.
	RunOnStart bool
	// Name is the name of this watcher.
	// It is used for logging/debugging purposes.
	Name string
	// Dir is the directory to watch files from.
	Dir string
	// IncludeFiles is a list of files relative to Dir to watch.
	IncludeFiles []string
	// IncludeSuffix is a list of file suffixes to watch.
	// Format: ".ext", "_templ.go", etc.
	IncludeSuffix []string
	// ExcludeSuffix is a list of file suffixes to exclude.
	// Format: ".ext", "_templ.go", etc.
	ExcludeSuffix []string

	// Fn is the function to call when a file is modified.
	Fn func([]string)
	// Batch is the time to wait before sending a batch of changed files.
	// This avoids sending multiple events if a tool (like Templ) modifies
	// multiple files at once. It is better to batch them together.
	Batch time.Duration
}

Jump to

Keyboard shortcuts

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