made changes

This commit is contained in:
Andrew Koung 2019-03-20 19:22:49 -04:00
parent 0d292068c4
commit 8a8e4219d2
1 changed files with 6 additions and 9 deletions

View File

@ -224,7 +224,7 @@ 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 //Stores initial prev value to compare
fs.stat(filename, function(err, stats) { prevStat = stats}); fs.stat(filename, function(err, stats) { prevStat = stats});
//stores interval return values //stores interval return values
@ -235,20 +235,17 @@ function FileSystem(options, callback) {
if(err) { if(err) {
console.log(err); console.log(err);
} }
//Store the current stat
currStat = stats; currStat = stats;
if((currStat.mtime - prevStat.mtime) == 0) { if(prevStat != currStat) {
//No changes listener(prevStat, currStat);
}
else {
//if theres a difference file change
//call listener here
} }
//Set a new prevStat based on previous
prevStat = currStat;
}); });
}, },
interval interval
); );
return watcher;
}; };
// Deal with various approaches to node ID creation // Deal with various approaches to node ID creation