Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFileName ¶
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) AddFilesEventHandlers ¶ added in v0.0.35
func (h *DevWatch) AddFilesEventHandlers(handlers ...FilesEventHandlers)
AddHandlers allows adding handlers dynamically after DevWatch initialization. This is useful when handlers are created after the watcher starts (e.g., deploy handlers). The method extracts UnobservedFiles from each handler and adds them to the no_add_to_watch map.
func (*DevWatch) FileWatcherStart ¶
func (*DevWatch) InitialRegistration ¶
func (h *DevWatch) InitialRegistration()
type FilesEventHandlers ¶ added in v0.0.31
type FilesEventHandlers interface {
MainInputFileRelativePath() string // eg: go => "app/server/main.go" | js =>"app/pwa/public/main.js"
// NewFileEvent handles file events (create, remove, write, rename).
NewFileEvent(fileName, extension, filePath, event string) error
SupportedExtensions() []string // eg: [".go"], [".js",".css"], etc.
UnobservedFiles() []string // eg: main.exe, main.js
}
FilesEventHandlers unifies asset and Go file event handling. It allows handlers to specify which file extensions they support and how to process them.
type FolderEvent ¶
event: create, remove, write, rename
type WatchConfig ¶
type WatchConfig struct {
AppRootDir string // eg: "home/user/myNewApp"
FilesEventHandlers []FilesEventHandlers // All file event handlers are managed here
FolderEvents FolderEvent // when directories are created/removed for architecture detection
BrowserReload func() error // when change frontend files reload browser
Logger func(message ...any) // 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",
}
Click to show internal directories.
Click to hide internal directories.