watch
Advanced tools
Comparing version 0.9.0 to 0.10.0
10
main.js
@@ -108,3 +108,3 @@ // Copyright 2010-2011 Mikeal Rogers | ||
var prevFile = {file: null,action: null}; | ||
var prevFile = {file: null,action: null,stat: null}; | ||
exports.watchTree(root, options, function (f, curr, prev) { | ||
@@ -116,12 +116,10 @@ if (typeof f == "object" && prev == null && curr === null) { | ||
if (prev === null && (prevFile.file != f || prevFile.action != "created")) { | ||
prevFile = { file: f, action: "created" }; | ||
prevFile = { file: f, action: "created", stat: curr }; | ||
return monitor.emit("created", f, curr); | ||
} | ||
if (curr.nlink === 0 && (prevFile.file != f || prevFile.action != "removed")) { | ||
prevFile = { file: f, action: "removed" }; | ||
prevFile = { file: f, action: "removed", stat: curr }; | ||
return monitor.emit("removed", f, curr); | ||
} | ||
if (prevFile.file != null) { | ||
prevFile = {file: null,action: null}; | ||
} else { | ||
if (prevFile.file === null || prevFile.stat.mtime.getTime() !== curr.mtime.getTime()) { | ||
monitor.emit("changed", f, curr, prev); | ||
@@ -128,0 +126,0 @@ } |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"homepage": "https://github.com/mikeal/watch", | ||
@@ -13,0 +13,0 @@ "bugs": { |
19143
190