devwatch

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 9 Imported by: 0

README

devwatch

fsnotify implementation Watches file system changes in a project directory, triggering custom handlers for file and folder events, and supporting browser reloads and selective file ignoring.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileName

func GetFileName(path string) (string, error)

GetFileName returns the filename from a path Example: "theme/index.html" -> "index.html"

Types

type DevWatch

type DevWatch struct {
	*WatchConfig
	// contains filtered or unexported fields
}

func New

func New(c *WatchConfig) *DevWatch

func (*DevWatch) Contain

func (h *DevWatch) Contain(path string) bool

func (*DevWatch) FileWatcherStart

func (h *DevWatch) FileWatcherStart(wg *sync.WaitGroup)

func (*DevWatch) InitialRegistration

func (h *DevWatch) InitialRegistration()

type FileEvent

type FileEvent interface {
	NewFileEvent(fileName, extension, filePath, event string) error
}

event: create, remove, write, rename

type FolderEvent

type FolderEvent interface {
	NewFolderEvent(folderName, path, event string) error
}

event: create, remove, write, rename

type WatchConfig

type WatchConfig struct {
	AppRootDir      string      // eg: "home/user/myNewApp"
	FileEventAssets FileEvent   // when change assets files eg: css, js, html, png, jpg, svg, etc event: create, remove, write, rename
	FileEventGO     FileEvent   // when change go files to backend or any destination
	FileEventWASM   FileEvent   // when change go files to webAssembly destination
	FolderEvents    FolderEvent // when directories are created/removed for architecture detection

	BrowserReload func() error // when change frontend files reload browser

	Writer          io.Writer       // For logging output
	ExitChan        chan bool       // global channel to signal the exit
	UnobservedFiles func() []string // files that are not observed by the watcher eg: ".git", ".gitignore", ".vscode",  "examples",
}

Jump to

Keyboard shortcuts

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