Change triggers add event and change event
Setup
gaze('**/*.js');
gaze.on('all', function(event, filepath) {
console.log('event', event);
console.log('filepath', filepath);
});
gaze.watched:
files { '/Users/me/project/src/':
[ '/Users/me/project/src/index.js',
'/Users/me/project/src/process.js' ] }
I change process.js
event added
filepath /Users/me/project/src/process.js
event changed
filepath /Users/me/project/src/process.js
Which version of gaze, node.js and OS/version? Thanks!
@shama Seems to be duplicate/part of #121.
gaze 0.6.4 mac osx mavericks 10.9.3 node v0.10.28
Are you editing with SublimeText 3 or another editor that does atomic saves? Eg write to temp file, then mv tmp to file? (See http://stackoverflow.com/questions/20634684/what-is-sublime-text-doing-when-i-save-a-file)
Using vim :w. Not sure what that triggers on the filesystem, but I would expect not to get an add event for a file multiple times without a delete event. I just don't feel like the developer should have to do this:
var files = {};
watcher.on('added', function(path){
if( ! files[path] ) ...
I suppose if the lib is just passing on system events it doesn't want to try to figure out which ones make sense for everyone, so perhaps an option could be available to ignore multiple 'added' events and just get the 'changed' events.