monocle.js
function watchFile(file, cb, partial) {
    setAbsolutePath(file);
    storeDirectory(file);
    if (!watched_files[file.fullPath]) {
      if (use_fs_watch) {
        (function() {
          watched_files[file.fullPath] = fs.watch(file.fullPath, function() {
            typeof cb === "function" && cb(file);
          });
          partial && cb(file);
        })(file, cb);
      } else {
        (function(file, cb) {
          watched_files[file.fullPath] = true;
          fs.watchFile(file.fullPath, {interval: 150}, function() {
            typeof cb === "function" && cb(file);
          });
          partial && cb(file);
        })(file, cb);
      }
    }
  }
function watchFile(file, cb, partial) {
    setAbsolutePath(file);
    storeDirectory(file);
    if (!watched_files[file.fullPath]) {
      if (use_fs_watch) {
        (function() {
          watched_files[file.fullPath] = fs.watch(file.fullPath, function() {
            typeof cb === "function" && cb(file);
          });
          partial && cb(file);
        })(file, cb);
      } else {
        (function(file, cb) {
          watched_files[file.fullPath] = true;
          fs.watchFile(file.fullPath, {interval: 150}, function() {
            typeof cb === "function" && cb(file);
          });
          partial && cb(file);
        })(file, cb);
      }
    }
  }
function watchFile ( file , cb , partial ) { setAbsolutePath ( file ) ; storeDirectory ( file ) ; if ( ! watched_files [ file . fullPath ] ) { if ( use_fs_watch ) { ( function ( ) { watched_files [ file . fullPath ] = fs . watch ( file . fullPath , function ( ) { typeof cb === "function" && cb ( file ) ; } ) ; partial && cb ( file ) ; } ) ( file , cb ) ; } else { ( function ( file , cb ) { watched_files [ file . fullPath ] = true ; fs . watchFile ( file . fullPath , { interval : 150 } , function ( ) { typeof cb === "function" && cb ( file ) ; } ) ; partial && cb ( file ) ; } ) ( file , cb ) ; } } }
Watches the file passed and its containing directory on change calls given listener with file object
Watches the file passed and its containing directory on change calls given listener with file object