From 5d2ee18de53d6c198a088f279a7caf7e310c5579 Mon Sep 17 00:00:00 2001 From: Timur Sevimli Date: Fri, 10 Nov 2023 17:40:11 +0300 Subject: [PATCH] Update usage example --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 72f1aba..3644d81 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ const metawatch = require('metawatch'); const options = { timeout: 200, excludes: { +<<<<<<< HEAD dirs: ['.git'], files: ['package.json'], exts: ['ts', 'md'], @@ -26,6 +27,15 @@ const options = { }; 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'); @@ -33,16 +43,24 @@ 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 }); }); ```