added more logic
This commit is contained in:
parent
58a3a30a6b
commit
0d292068c4
|
@ -224,17 +224,25 @@ function FileSystem(options, callback) {
|
||||||
const interval = options.interval || 5007;
|
const interval = options.interval || 5007;
|
||||||
listener = listener || nop;
|
listener = listener || nop;
|
||||||
|
|
||||||
|
//Stores prev value to compare
|
||||||
|
fs.stat(filename, function(err, stats) { prevStat = stats});
|
||||||
|
|
||||||
//stores interval return values
|
//stores interval return values
|
||||||
statWatchers.set(filename, value);
|
statWatchers.set(filename, value);
|
||||||
|
|
||||||
var value = setInterval(function() {
|
var value = setInterval(function() {
|
||||||
fs.stat(filename, function(err, stats) {
|
fs.stat(filename, function(err, stats) {
|
||||||
if(err) {
|
if(err) {
|
||||||
//console.log(err);
|
console.log(err);
|
||||||
|
}
|
||||||
|
currStat = stats;
|
||||||
|
if((currStat.mtime - prevStat.mtime) == 0) {
|
||||||
|
//No changes
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//if theres a difference file change
|
||||||
|
//call listener here
|
||||||
}
|
}
|
||||||
//record file curr
|
|
||||||
//compare curr-prev
|
|
||||||
//if theres a difference file change
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
interval
|
interval
|
||||||
|
|
Loading…
Reference in New Issue