Documentation
¶
Overview ¶
Package observer implements an event emitter and listener with builtin file watcher.
Package observer implements an event emitter and listener with builtin file watcher.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Observer ¶
type Observer struct { Verbose bool // contains filtered or unexported fields }
Observer emplements the observer pattern.
func (*Observer) AddListener ¶
AddListener adds a listener function to run on event, the listener function will recive the event object as argument.
func (*Observer) Emit ¶
func (o *Observer) Emit(event interface{})
Emit an event, and event can be of any type, when event is triggered all listeners will be called using the event object.
func (*Observer) Open ¶
Open the observer channles and run the event loop, it will return an error if event loop already running.
func (*Observer) SetBufferDuration ¶
SetBufferDuration set the event buffer damping duration.
type Op ¶
type Op uint32
Op (fsnotify.Op) describes a set of file operations.
These are the generalized file operations that can trigger a notification.
type WatchEvent ¶
type WatchEvent struct { Name string // Relative path to the file or directory. Op Op // File operation that triggered the event. }
WatchEvent (fsnotify.Event) represents a single file system notification.