Skip to content

Commit

Permalink
Update usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
timursevimli committed Nov 10, 2023
1 parent 72e9f7e commit 5d2ee18
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,48 @@ const metawatch = require('metawatch');
const options = {
timeout: 200,
excludes: {
<<<<<<< HEAD
dirs: ['.git'],
files: ['package.json'],
exts: ['ts', 'md'],
},
};

const watcher = new metawatch.DirectoryWatcher(options);
=======
dirs: ['.git', 'node_modules'],
files: ['package.json'],
exts: ['jsx', 'ts'],
},
};

const watcher = new metawatch.DirectoryWatcher();
>>>>>>> 26fc864 (Update usage example)
watcher.watch('/home/marcus/Downloads');
watcher.watch('/home/marcus/Documents');

watcher.on('change', (fileName) => {
console.log({ changed: fileName });
});

watcher.on('delete', (fileName) => {
watcher.on('unlink', (fileName) => {
console.log({ deleted: fileName });
});

watcher.on('unlinkDir', (dirName) => {
console.log({ deleted: dirName });
});

watcher.on('before', (changes) => {
console.log({ changes });
console.log({ before: changes });
});

watcher.on('after', (changes) => {
console.log({ changes });
console.log({ after: changes });
});

watcher.on('*', (change) => {
console.log({ change });
});
```

Expand Down

0 comments on commit 5d2ee18

Please sign in to comment.