Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Re-attach watchers on rename-event.

 - or it only works once.
  • Loading branch information...
commit 455190a87e170335aaa69490cc95f4c00153afba 1 parent bf174a6
@magnars authored
Showing with 6 additions and 5 deletions.
  1. +5 −3 lib/watch-for-changes.js
  2. +1 −2  package.json
View
8 lib/watch-for-changes.js
@@ -1,9 +1,11 @@
var fs = require("fs");
function lintOnChange(linter, file) {
- fs.watch(file, function (event) {
- if (event === "change") {
- linter.checkFile(file);
+ var watcher = fs.watch(file, function (event) {
+ linter.checkFile(file);
+ if (event === "rename") {
+ watcher.close();
+ lintOnChange(linter, file);
}
});
}
View
3  package.json
@@ -22,8 +22,7 @@
"glob": "~3.0",
"growl": "~1.1",
"underscore": "~1.1",
- "when": "https://github.com/cujojs/when/tarball/1.0.2",
- "watch": "~0.6"
+ "when": "https://github.com/cujojs/when/tarball/1.0.2"
},
"devDependencies": {
"buster": "~0.6",
Please sign in to comment.
Something went wrong with that request. Please try again.