watcher

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package watcher is a stupid time-based file modification watcher, I expect to use fsnotify once it becomes consistent among all platforms. You should not use it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name string
	// contains filtered or unexported fields
}

Event is the struct that watches a file.

func (*Event) IsModify

func (ev *Event) IsModify() bool

IsModify returns true if the event was a file modification, then it resets the modified flag.

type Watcher

type Watcher struct {
	Files map[string]*WatcherFile
	Event chan (*Event)
	// contains filtered or unexported fields
}

Watcher is the struct that handles a the list of file to watch.

func New

func New() (*Watcher, error)

New allocates, returns a file watcher and starts the watching loop.

func (*Watcher) Close

func (w *Watcher) Close()

Close makes a watcher sleep.

func (*Watcher) RemoveWatch

func (w *Watcher) RemoveWatch(file string) error

RemoveWatch deletes a file from the watching list.

func (*Watcher) Watch

func (w *Watcher) Watch(file string) error

Watch adds a file to the watching list.

type WatcherFile

type WatcherFile struct {
	Filemtime time.Time
}

WatcherFile is the struct that handles the last known file properties.

Jump to

Keyboard shortcuts

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