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