First of all, thanks for this amazing job! I wanna trigger some actions when the last event occur in the dir, how could i do that?
Use debounce function for this purpose. You can find one in lodash
var watcher = chokidar.watch('file or dir', {ignored: /^\./, persistent: true});
watcher.on('all', _.debounce(function(event, path) {
console.log('trigger some action on last occurred event.')
// max interval between events for this fn to execute is 300ms
}, 300));
Thanks a lot!
Most helpful comment
Use
debouncefunction for this purpose. You can find one in lodash