watcher

package
v0.0.0-...-8ea0922 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 6 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 set of directories for .md file changes and calls onChange. Meta directories additionally trigger onChange on any event — they cover state whose shape matters more than its content, like the git common dir's worktrees/ registry.

func New

func New(dir string, onChange func(), debounce time.Duration) *Watcher

New creates a Watcher that monitors dir for markdown file changes.

func (*Watcher) SetDirs

func (w *Watcher) SetDirs(dirs, metaDirs []string)

SetDirs replaces the watched directory sets. Stale watches are removed and new roots added; safe to call before Start (Start picks the sets up) or from the onChange callback while running.

func (*Watcher) Start

func (w *Watcher) Start() error

Start begins watching. It blocks until Stop is called or an error occurs.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop signals the watcher to stop.

Jump to

Keyboard shortcuts

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