watcher

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func Debounce

func Debounce(f func(), d time.Duration) func()

Debounce 防抖

Types

type Watcher

type Watcher struct {
	BasePath string

	Events chan fsnotify.Event
	Errs   chan error
	// contains filtered or unexported fields
}

Watcher 文件监控

func NewWatcher

func NewWatcher(basePath string) (*Watcher, error)

NewWactcher 构造文件监控

func (*Watcher) AddEvent

func (watcher *Watcher) AddEvent(events ...fsnotify.Op)

AddEvent 添加监听事件

func (*Watcher) AddExcludes

func (watcher *Watcher) AddExcludes(names ...string)

AddExcludes 添加排除文件

func (*Watcher) AddIncludes

func (watcher *Watcher) AddIncludes(names ...string)

AddIncludes 添加包含文件

func (*Watcher) AddWatch

func (watcher *Watcher) AddWatch(name string) error

AddWatch 添加监听文件

func (*Watcher) Close

func (watcher *Watcher) Close()

Close 关闭文件监控

func (*Watcher) Init

func (watcher *Watcher) Init() error

Init 初始化监听

func (*Watcher) RemoveWatch

func (watcher *Watcher) RemoveWatch(name string) error

RemoveWatch 删除监听

func (*Watcher) Watch

func (watcher *Watcher) Watch()

Watch 开始监听

Jump to

Keyboard shortcuts

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