Add support for custom watch function

Network filesystems don't like `fs.watch`. This change makes it possible to optionally use a custom watch function (eg: `fs.watchFile`).