common/fs/deep-watch.js
function checkDir () {
  var n = indexes[i]
  if (i > 44) {
    indexes[i] = (indexes[i] + 5) % list.length
  }
  i = (i + 1) % indexes.length
  var dir = list[n]
  if (dir) {
    fs.stat(dir, function (e, stat) {
      if (!e && (stat.mtime > okToNotifyAfter)) {
        fs.readdir(dir, function (e, files) {
          if (!e) {
            files.forEach(function (file) {
              var path = dir + '/' + file
              fs.stat(path, function (e, stat) {
                if (!e && (stat.mtime > okToNotifyAfter)) {
                  notify(path)
                }
              })
            })
          }
        })
      }
    })
  }
}
function checkDir () {
  var n = indexes[i]
  if (i > 44) {
    indexes[i] = (indexes[i] + 5) % list.length
  }
  i = (i + 1) % indexes.length
  var dir = list[n]
  if (dir) {
    fs.stat(dir, function (e, stat) {
      if (!e && (stat.mtime > okToNotifyAfter)) {
        fs.readdir(dir, function (e, files) {
          if (!e) {
            files.forEach(function (file) {
              var path = dir + '/' + file
              fs.stat(path, function (e, stat) {
                if (!e && (stat.mtime > okToNotifyAfter)) {
                  notify(path)
                }
              })
            })
          }
        })
      }
    })
  }
}
Check a directory for changes.