Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Watcher

The base watcher class, that handles all file watches and fires events accordingly.

Hierarchy

Index

Constructors

constructor

  • new Watcher(config: Config, listeners: WatcherListeners): Watcher

Properties

Protected config

config: Config

The Config object provided to this instance.

Protected display

display: Display

The Display instance which allows displaying user configued messages.

Private instance

instance: FSWatcher

The instance of the chokidar watcher that powers this wrapper class.

Private listeners

listeners: WatcherListeners

The list of handlers attached to events in this instance. Handlers can be attached to the onBeforeStart, onStart, onBeforeChange, onChange, onBeforeStop or onStop events.

Protected log

log: Logger

The Logger instance which allows various log types based on level.

Private paths

paths: string | string[]

The paths generated by this Watcher instance, using the config.

Private root

root: string

The root path generated by this Watcher instance, using the config.

Private thread

thread: Thread

The instance of Thread which manages the execution of commands on firing of watcher event.

Methods

Private bindWatcherEvents

  • bindWatcherEvents(): Promise<void>

getInstance

  • getInstance(): FSWatcher

on

  • on(event: WatcherEvent, eventHandler: Function): void
  • Allows attaching a handler to an watcher event. Does not attach event if event is not valid.

    Parameters

    • event: WatcherEvent

      The event to fire this function for. Possible options are onBeforeStart, onStart, onBeforeChange, onChange, onBeforeStop and onStop.

    • eventHandler: Function

      The event handler function. Receives

    Returns void

Generated using TypeDoc